This repository has been archived on 2026-08-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
zq/.obsidian/plugins/copilot/main.js
T
starmen1265 ea9a5c3b3f 初始提交:知识库工作区
- 00.收件箱
- 01.待办
- 10.项目
- 20.领域
- 30.资源
- 40.归档
- 50.模板
2026-03-03 18:25:09 +08:00

1408 lines
3.1 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var U3t=Object.create;var hq=Object.defineProperty;var z3t=Object.getOwnPropertyDescriptor;var H3t=Object.getOwnPropertyNames;var V3t=Object.getPrototypeOf,W3t=Object.prototype.hasOwnProperty;var J3t=(t,e,r)=>e in t?hq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var C=(t,e)=>()=>(t&&(e=t(t=0)),e);var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nf=(t,e)=>{for(var r in e)hq(t,r,{get:e[r],enumerable:!0})},E1e=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of H3t(e))!W3t.call(t,o)&&o!==r&&hq(t,o,{get:()=>e[o],enumerable:!(n=z3t(e,o))||n.enumerable});return t};var B=(t,e,r)=>(r=t!=null?U3t(V3t(t)):{},E1e(e||!t||!t.__esModule?hq(r,"default",{value:t,enumerable:!0}):r,t)),ml=t=>E1e(hq({},"__esModule",{value:!0}),t);var Vl=(t,e,r)=>(J3t(t,typeof e!="symbol"?e+"":e,r),r);function K3t(t){M1e=t}function fV(){return M1e}function He(t,e){let r=fV(),n=pV({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===cj?void 0:cj].filter(o=>!!o)});t.common.issues.push(n)}function hV(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function A1e(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function _r(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}function I1e(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function p8t(t){return new RegExp(`^${I1e(t)}$`)}function D1e(t){let e=`${R1e}T${I1e(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function h8t(t,e){return!!((e==="v4"||!e)&&a8t.test(t)||(e==="v6"||!e)&&u8t.test(t))}function m8t(t,e){if(!r8t.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function g8t(t,e){return!!((e==="v4"||!e)&&s8t.test(t)||(e==="v6"||!e)&&l8t.test(t))}function y8t(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function uj(t){if(t instanceof yi){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=of.create(uj(n))}return new yi({...t._def,shape:()=>e})}else return t instanceof np?new np({...t._def,type:uj(t.element)}):t instanceof of?of.create(uj(t.unwrap())):t instanceof wy?wy.create(uj(t.unwrap())):t instanceof oh?oh.create(t.items.map(e=>uj(e))):t}function zae(t,e){let r=VS(t),n=VS(e);if(t===e)return{valid:!0,data:t};if(r===Qe.object&&n===Qe.object){let o=Cn.objectKeys(e),i=Cn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=zae(t[s],e[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(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=zae(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&&+t==+e?{valid:!0,data:t}:{valid:!1}}function j1e(t,e){return new vy({values:t,typeName:ne.ZodEnum,..._r(e)})}function N1e(t,e={},r){return t?WO.create().superRefine((n,o)=>{var i,a;if(!t(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,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})}}):WO.create()}var Cn,$ae,Qe,VS,we,G3t,Od,cj,M1e,pV,Y3t,gl,Ut,lj,Ed,qae,Uae,YM,yq,yt,mq,gq,nh,P1e,vr,X3t,Z3t,Q3t,e8t,t8t,r8t,n8t,o8t,i8t,Bae,a8t,s8t,u8t,l8t,c8t,d8t,R1e,f8t,rp,by,_y,XM,JS,dj,ZM,QM,WO,WS,zm,fj,np,yi,eA,HS,pj,tA,oh,rA,hj,GS,VO,nA,oA,vy,iA,JO,op,of,wy,aA,sA,mj,b8t,bq,uA,lA,_8t,ne,v8t,L1e,F1e,w8t,S8t,k1e,x8t,C8t,O8t,E8t,P8t,T8t,M8t,A8t,R8t,I8t,D8t,j8t,N8t,L8t,F8t,k8t,B8t,$8t,q8t,U8t,z8t,H8t,V8t,W8t,T1e,J8t,G8t,K8t,Y8t,X8t,Z8t,Q8t,eHt,tHt,Pr,Pd=C(()=>{(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Cn||(Cn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})($ae||($ae={}));Qe=Cn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),VS=t=>{switch(typeof t){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return isNaN(t)?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(t)?Qe.array:t===null?Qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Qe.promise:typeof Map<"u"&&t instanceof Map?Qe.map:typeof Set<"u"&&t instanceof Set?Qe.set:typeof Date<"u"&&t instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},we=Cn.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"]),G3t=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Od=class extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof Od))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Cn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Od.create=t=>new Od(t);cj=(t,e)=>{let r;switch(t.code){case we.invalid_type:t.received===Qe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case we.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Cn.jsonStringifyReplacer)}`;break;case we.unrecognized_keys:r=`Unrecognized key(s) in object: ${Cn.joinValues(t.keys,", ")}`;break;case we.invalid_union:r="Invalid input";break;case we.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Cn.joinValues(t.options)}`;break;case we.invalid_enum_value:r=`Invalid enum value. Expected ${Cn.joinValues(t.options)}, received '${t.received}'`;break;case we.invalid_arguments:r="Invalid function arguments";break;case we.invalid_return_type:r="Invalid function return type";break;case we.invalid_date:r="Invalid date";break;case we.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Cn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case we.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case we.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case we.custom:r="Invalid input";break;case we.invalid_intersection_types:r="Intersection results could not be merged";break;case we.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case we.not_finite:r="Number must be finite";break;default:r=e.defaultError,Cn.assertNever(t)}return{message:r}},M1e=cj;pV=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}},Y3t=[];gl=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Ut;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return gl.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Ut;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},Ut=Object.freeze({status:"aborted"}),lj=t=>({status:"dirty",value:t}),Ed=t=>({status:"valid",value:t}),qae=t=>t.status==="aborted",Uae=t=>t.status==="dirty",YM=t=>t.status==="valid",yq=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(yt||(yt={}));nh=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},P1e=(t,e)=>{if(YM(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Od(t.common.issues);return this._error=r,this._error}}};vr=class{get description(){return this._def.description}_getType(e){return VS(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:VS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gl,ctx:{common:e.parent.common,data:e.data,parsedType:VS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(yq(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:VS(e)},i=this._parseSync({data:e,path:o.path,parent:o});return P1e(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:VS(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return YM(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>YM(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:VS(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(yq(o)?o:Promise.resolve(o));return P1e(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:we.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new op({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return of.create(this,this._def)}nullable(){return wy.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return np.create(this)}promise(){return JO.create(this,this._def)}or(e){return eA.create([this,e],this._def)}and(e){return tA.create(this,e,this._def)}transform(e){return new op({..._r(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new aA({..._r(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new bq({typeName:ne.ZodBranded,type:this,..._r(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new sA({..._r(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return uA.create(this,e)}readonly(){return lA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},X3t=/^c[^\s-]{8,}$/i,Z3t=/^[0-9a-z]+$/,Q3t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,e8t=/^[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,t8t=/^[a-z0-9_-]{21}$/i,r8t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,n8t=/^[-+]?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)?)??$/,o8t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,i8t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",a8t=/^(?:(?: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])$/,s8t=/^(?:(?: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])$/,u8t=/^(([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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,c8t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,d8t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R1e="((\\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])))",f8t=new RegExp(`^${R1e}$`);rp=class extends vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Qe.string){let i=this._getOrReturnCtx(e);return He(i,{code:we.invalid_type,expected:Qe.string,received:i.parsedType}),Ut}let n=new gl,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),He(o,{code:we.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),He(o,{code:we.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?He(o,{code:we.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&He(o,{code:we.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")o8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"email",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Bae||(Bae=new RegExp(i8t,"u")),Bae.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"emoji",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")e8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"uuid",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")t8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"nanoid",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")X3t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"cuid",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Z3t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"cuid2",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Q3t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"ulid",code:we.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),He(o,{validation:"url",code:we.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"regex",code:we.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?D1e(i).test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?f8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?p8t(i).test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{code:we.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?n8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"duration",code:we.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?h8t(e.data,i.version)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"ip",code:we.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?m8t(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"jwt",code:we.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?g8t(e.data,i.version)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"cidr",code:we.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?c8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"base64",code:we.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?d8t.test(e.data)||(o=this._getOrReturnCtx(e,o),He(o,{validation:"base64url",code:we.invalid_string,message:i.message}),n.dirty()):Cn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:we.invalid_string,...yt.errToObj(n)})}_addCheck(e){return new rp({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...yt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...yt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...yt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...yt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...yt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...yt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...yt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...yt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...yt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...yt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...yt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...yt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...yt.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...yt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...yt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...yt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...yt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...yt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...yt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...yt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...yt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...yt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...yt.errToObj(r)})}nonempty(e){return this.min(1,yt.errToObj(e))}trim(){return new rp({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rp({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rp({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};rp.create=t=>{var e;return new rp({checks:[],typeName:ne.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,..._r(t)})};by=class extends vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Qe.number){let i=this._getOrReturnCtx(e);return He(i,{code:we.invalid_type,expected:Qe.number,received:i.parsedType}),Ut}let n,o=new gl;for(let i of this._def.checks)i.kind==="int"?Cn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),He(n,{code:we.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?y8t(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),He(n,{code:we.not_finite,message:i.message}),o.dirty()):Cn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,yt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,yt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,yt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,yt.toString(r))}setLimit(e,r,n,o){return new by({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:yt.toString(o)}]})}_addCheck(e){return new by({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:yt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:yt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:yt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:yt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:yt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:yt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:yt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:yt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:yt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Cn.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};by.create=t=>new by({checks:[],typeName:ne.ZodNumber,coerce:t?.coerce||!1,..._r(t)});_y=class extends vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Qe.bigint)return this._getInvalidInput(e);let n,o=new gl;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),He(n,{code:we.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Cn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return He(r,{code:we.invalid_type,expected:Qe.bigint,received:r.parsedType}),Ut}gte(e,r){return this.setLimit("min",e,!0,yt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,yt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,yt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,yt.toString(r))}setLimit(e,r,n,o){return new _y({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:yt.toString(o)}]})}_addCheck(e){return new _y({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:yt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:yt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:yt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:yt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:yt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};_y.create=t=>{var e;return new _y({checks:[],typeName:ne.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,..._r(t)})};XM=class extends vr{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Qe.boolean){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.boolean,received:n.parsedType}),Ut}return Ed(e.data)}};XM.create=t=>new XM({typeName:ne.ZodBoolean,coerce:t?.coerce||!1,..._r(t)});JS=class extends vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Qe.date){let i=this._getOrReturnCtx(e);return He(i,{code:we.invalid_type,expected:Qe.date,received:i.parsedType}),Ut}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return He(i,{code:we.invalid_date}),Ut}let n=new gl,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),He(o,{code:we.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),He(o,{code:we.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Cn.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new JS({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:yt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:yt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};JS.create=t=>new JS({checks:[],coerce:t?.coerce||!1,typeName:ne.ZodDate,..._r(t)});dj=class extends vr{_parse(e){if(this._getType(e)!==Qe.symbol){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.symbol,received:n.parsedType}),Ut}return Ed(e.data)}};dj.create=t=>new dj({typeName:ne.ZodSymbol,..._r(t)});ZM=class extends vr{_parse(e){if(this._getType(e)!==Qe.undefined){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.undefined,received:n.parsedType}),Ut}return Ed(e.data)}};ZM.create=t=>new ZM({typeName:ne.ZodUndefined,..._r(t)});QM=class extends vr{_parse(e){if(this._getType(e)!==Qe.null){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.null,received:n.parsedType}),Ut}return Ed(e.data)}};QM.create=t=>new QM({typeName:ne.ZodNull,..._r(t)});WO=class extends vr{constructor(){super(...arguments),this._any=!0}_parse(e){return Ed(e.data)}};WO.create=t=>new WO({typeName:ne.ZodAny,..._r(t)});WS=class extends vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ed(e.data)}};WS.create=t=>new WS({typeName:ne.ZodUnknown,..._r(t)});zm=class extends vr{_parse(e){let r=this._getOrReturnCtx(e);return He(r,{code:we.invalid_type,expected:Qe.never,received:r.parsedType}),Ut}};zm.create=t=>new zm({typeName:ne.ZodNever,..._r(t)});fj=class extends vr{_parse(e){if(this._getType(e)!==Qe.undefined){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.void,received:n.parsedType}),Ut}return Ed(e.data)}};fj.create=t=>new fj({typeName:ne.ZodVoid,..._r(t)});np=class extends vr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Qe.array)return He(r,{code:we.invalid_type,expected:Qe.array,received:r.parsedType}),Ut;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?we.too_big:we.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:we.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:we.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 nh(r,a,r.path,s)))).then(a=>gl.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new nh(r,a,r.path,s)));return gl.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new np({...this._def,minLength:{value:e,message:yt.toString(r)}})}max(e,r){return new np({...this._def,maxLength:{value:e,message:yt.toString(r)}})}length(e,r){return new np({...this._def,exactLength:{value:e,message:yt.toString(r)}})}nonempty(e){return this.min(1,e)}};np.create=(t,e)=>new np({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,..._r(e)});yi=class extends vr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Cn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Qe.object){let l=this._getOrReturnCtx(e);return He(l,{code:we.invalid_type,expected:Qe.object,received:l.parsedType}),Ut}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof zm&&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 nh(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof zm){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:we.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 nh(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=>gl.mergeObjectSync(n,l)):gl.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return yt.errToObj,new yi({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=yt.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new yi({...this._def,unknownKeys:"strip"})}passthrough(){return new yi({...this._def,unknownKeys:"passthrough"})}extend(e){return new yi({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yi({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new yi({...this._def,catchall:e})}pick(e){let r={};return Cn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new yi({...this._def,shape:()=>r})}omit(e){let r={};return Cn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new yi({...this._def,shape:()=>r})}deepPartial(){return uj(this)}partial(e){let r={};return Cn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new yi({...this._def,shape:()=>r})}required(e){let r={};return Cn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof of;)i=i._def.innerType;r[n]=i}}),new yi({...this._def,shape:()=>r})}keyof(){return j1e(Cn.objectKeys(this.shape))}};yi.create=(t,e)=>new yi({shape:()=>t,unknownKeys:"strip",catchall:zm.create(),typeName:ne.ZodObject,..._r(e)});yi.strictCreate=(t,e)=>new yi({shape:()=>t,unknownKeys:"strict",catchall:zm.create(),typeName:ne.ZodObject,..._r(e)});yi.lazycreate=(t,e)=>new yi({shape:t,unknownKeys:"strip",catchall:zm.create(),typeName:ne.ZodObject,..._r(e)});eA=class extends vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Od(s.ctx.common.issues));return He(r,{code:we.invalid_union,unionErrors:a}),Ut}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 Od(u));return He(r,{code:we.invalid_union,unionErrors:s}),Ut}}get options(){return this._def.options}};eA.create=(t,e)=>new eA({options:t,typeName:ne.ZodUnion,..._r(e)});HS=t=>t instanceof nA?HS(t.schema):t instanceof op?HS(t.innerType()):t instanceof oA?[t.value]:t instanceof vy?t.options:t instanceof iA?Cn.objectValues(t.enum):t instanceof aA?HS(t._def.innerType):t instanceof ZM?[void 0]:t instanceof QM?[null]:t instanceof of?[void 0,...HS(t.unwrap())]:t instanceof wy?[null,...HS(t.unwrap())]:t instanceof bq||t instanceof lA?HS(t.unwrap()):t instanceof sA?HS(t._def.innerType):[],pj=class extends vr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qe.object)return He(r,{code:we.invalid_type,expected:Qe.object,received:r.parsedType}),Ut;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:we.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=HS(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new pj({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,..._r(n)})}};tA=class extends vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(qae(i)||qae(a))return Ut;let s=zae(i.value,a.value);return s.valid?((Uae(i)||Uae(a))&&r.dirty(),{status:r.value,value:s.data}):(He(n,{code:we.invalid_intersection_types}),Ut)};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}))}};tA.create=(t,e,r)=>new tA({left:t,right:e,typeName:ne.ZodIntersection,..._r(r)});oh=class extends vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.array)return He(n,{code:we.invalid_type,expected:Qe.array,received:n.parsedType}),Ut;if(n.data.length<this._def.items.length)return He(n,{code:we.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ut;!this._def.rest&&n.data.length>this._def.items.length&&(He(n,{code:we.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 nh(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>gl.mergeArray(r,a)):gl.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new oh({...this._def,rest:e})}};oh.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oh({items:t,typeName:ne.ZodTuple,rest:null,..._r(e)})};rA=class extends vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.object)return He(n,{code:we.invalid_type,expected:Qe.object,received:n.parsedType}),Ut;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new nh(n,s,n.path,s)),value:a._parse(new nh(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?gl.mergeObjectAsync(r,o):gl.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof vr?new rA({keyType:e,valueType:r,typeName:ne.ZodRecord,..._r(n)}):new rA({keyType:rp.create(),valueType:e,typeName:ne.ZodRecord,..._r(r)})}},hj=class extends vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.map)return He(n,{code:we.invalid_type,expected:Qe.map,received:n.parsedType}),Ut;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new nh(n,s,n.path,[l,"key"])),value:i._parse(new nh(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 Ut;(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 Ut;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};hj.create=(t,e,r)=>new hj({valueType:e,keyType:t,typeName:ne.ZodMap,..._r(r)});GS=class extends vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.set)return He(n,{code:we.invalid_type,expected:Qe.set,received:n.parsedType}),Ut;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(He(n,{code:we.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:we.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 Ut;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 nh(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new GS({...this._def,minSize:{value:e,message:yt.toString(r)}})}max(e,r){return new GS({...this._def,maxSize:{value:e,message:yt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};GS.create=(t,e)=>new GS({valueType:t,minSize:null,maxSize:null,typeName:ne.ZodSet,..._r(e)});VO=class extends vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qe.function)return He(r,{code:we.invalid_type,expected:Qe.function,received:r.parsedType}),Ut;function n(s,u){return pV({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fV(),cj].filter(l=>!!l),issueData:{code:we.invalid_arguments,argumentsError:u}})}function o(s,u){return pV({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fV(),cj].filter(l=>!!l),issueData:{code:we.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof JO){let s=this;return Ed(async function(...u){let l=new Od([]),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 Ed(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Od([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Od([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new VO({...this._def,args:oh.create(e).rest(WS.create())})}returns(e){return new VO({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new VO({args:e||oh.create([]).rest(WS.create()),returns:r||WS.create(),typeName:ne.ZodFunction,..._r(n)})}},nA=class extends vr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};nA.create=(t,e)=>new nA({getter:t,typeName:ne.ZodLazy,..._r(e)});oA=class extends vr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return He(r,{received:r.data,code:we.invalid_literal,expected:this._def.value}),Ut}return{status:"valid",value:e.data}}get value(){return this._def.value}};oA.create=(t,e)=>new oA({value:t,typeName:ne.ZodLiteral,..._r(e)});vy=class extends vr{constructor(){super(...arguments),mq.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return He(r,{expected:Cn.joinValues(n),received:r.parsedType,code:we.invalid_type}),Ut}if(hV(this,mq,"f")||A1e(this,mq,new Set(this._def.values),"f"),!hV(this,mq,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return He(r,{received:r.data,code:we.invalid_enum_value,options:n}),Ut}return Ed(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return vy.create(e,{...this._def,...r})}exclude(e,r=this._def){return vy.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};mq=new WeakMap;vy.create=j1e;iA=class extends vr{constructor(){super(...arguments),gq.set(this,void 0)}_parse(e){let r=Cn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Qe.string&&n.parsedType!==Qe.number){let o=Cn.objectValues(r);return He(n,{expected:Cn.joinValues(o),received:n.parsedType,code:we.invalid_type}),Ut}if(hV(this,gq,"f")||A1e(this,gq,new Set(Cn.getValidEnumValues(this._def.values)),"f"),!hV(this,gq,"f").has(e.data)){let o=Cn.objectValues(r);return He(n,{received:n.data,code:we.invalid_enum_value,options:o}),Ut}return Ed(e.data)}get enum(){return this._def.values}};gq=new WeakMap;iA.create=(t,e)=>new iA({values:t,typeName:ne.ZodNativeEnum,..._r(e)});JO=class extends vr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qe.promise&&r.common.async===!1)return He(r,{code:we.invalid_type,expected:Qe.promise,received:r.parsedType}),Ut;let n=r.parsedType===Qe.promise?r.data:Promise.resolve(r.data);return Ed(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};JO.create=(t,e)=>new JO({type:t,typeName:ne.ZodPromise,..._r(e)});op=class extends vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{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 Ut;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Ut:u.status==="dirty"||r.value==="dirty"?lj(u.value):u});{if(r.value==="aborted")return Ut;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Ut:s.status==="dirty"||r.value==="dirty"?lj(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"?Ut:(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"?Ut:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!YM(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>YM(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Cn.assertNever(o)}};op.create=(t,e,r)=>new op({schema:t,typeName:ne.ZodEffects,effect:e,..._r(r)});op.createWithPreprocess=(t,e,r)=>new op({schema:e,effect:{type:"preprocess",transform:t},typeName:ne.ZodEffects,..._r(r)});of=class extends vr{_parse(e){return this._getType(e)===Qe.undefined?Ed(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};of.create=(t,e)=>new of({innerType:t,typeName:ne.ZodOptional,..._r(e)});wy=class extends vr{_parse(e){return this._getType(e)===Qe.null?Ed(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wy.create=(t,e)=>new wy({innerType:t,typeName:ne.ZodNullable,..._r(e)});aA=class extends vr{_parse(e){let{ctx:r}=this._processInputParams(e),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}};aA.create=(t,e)=>new aA({innerType:t,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._r(e)});sA=class extends vr{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return yq(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Od(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Od(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};sA.create=(t,e)=>new sA({innerType:t,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._r(e)});mj=class extends vr{_parse(e){if(this._getType(e)!==Qe.nan){let n=this._getOrReturnCtx(e);return He(n,{code:we.invalid_type,expected:Qe.nan,received:n.parsedType}),Ut}return{status:"valid",value:e.data}}};mj.create=t=>new mj({typeName:ne.ZodNaN,..._r(t)});b8t=Symbol("zod_brand"),bq=class extends vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},uA=class extends vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ut:i.status==="dirty"?(r.dirty(),lj(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"?Ut:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new uA({in:e,out:r,typeName:ne.ZodPipeline})}},lA=class extends vr{_parse(e){let r=this._def.innerType._parse(e),n=o=>(YM(o)&&(o.value=Object.freeze(o.value)),o);return yq(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};lA.create=(t,e)=>new lA({innerType:t,typeName:ne.ZodReadonly,..._r(e)});_8t={object:yi.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ne||(ne={}));v8t=(t,e={message:`Input not instance of ${t.name}`})=>N1e(r=>r instanceof t,e),L1e=rp.create,F1e=by.create,w8t=mj.create,S8t=_y.create,k1e=XM.create,x8t=JS.create,C8t=dj.create,O8t=ZM.create,E8t=QM.create,P8t=WO.create,T8t=WS.create,M8t=zm.create,A8t=fj.create,R8t=np.create,I8t=yi.create,D8t=yi.strictCreate,j8t=eA.create,N8t=pj.create,L8t=tA.create,F8t=oh.create,k8t=rA.create,B8t=hj.create,$8t=GS.create,q8t=VO.create,U8t=nA.create,z8t=oA.create,H8t=vy.create,V8t=iA.create,W8t=JO.create,T1e=op.create,J8t=of.create,G8t=wy.create,K8t=op.createWithPreprocess,Y8t=uA.create,X8t=()=>L1e().optional(),Z8t=()=>F1e().optional(),Q8t=()=>k1e().optional(),eHt={string:t=>rp.create({...t,coerce:!0}),number:t=>by.create({...t,coerce:!0}),boolean:t=>XM.create({...t,coerce:!0}),bigint:t=>_y.create({...t,coerce:!0}),date:t=>JS.create({...t,coerce:!0})},tHt=Ut,Pr=Object.freeze({__proto__:null,defaultErrorMap:cj,setErrorMap:K3t,getErrorMap:fV,makeIssue:pV,EMPTY_PATH:Y3t,addIssueToContext:He,ParseStatus:gl,INVALID:Ut,DIRTY:lj,OK:Ed,isAborted:qae,isDirty:Uae,isValid:YM,isAsync:yq,get util(){return Cn},get objectUtil(){return $ae},ZodParsedType:Qe,getParsedType:VS,ZodType:vr,datetimeRegex:D1e,ZodString:rp,ZodNumber:by,ZodBigInt:_y,ZodBoolean:XM,ZodDate:JS,ZodSymbol:dj,ZodUndefined:ZM,ZodNull:QM,ZodAny:WO,ZodUnknown:WS,ZodNever:zm,ZodVoid:fj,ZodArray:np,ZodObject:yi,ZodUnion:eA,ZodDiscriminatedUnion:pj,ZodIntersection:tA,ZodTuple:oh,ZodRecord:rA,ZodMap:hj,ZodSet:GS,ZodFunction:VO,ZodLazy:nA,ZodLiteral:oA,ZodEnum:vy,ZodNativeEnum:iA,ZodPromise:JO,ZodEffects:op,ZodTransformer:op,ZodOptional:of,ZodNullable:wy,ZodDefault:aA,ZodCatch:sA,ZodNaN:mj,BRAND:b8t,ZodBranded:bq,ZodPipeline:uA,ZodReadonly:lA,custom:N1e,Schema:vr,ZodSchema:vr,late:_8t,get ZodFirstPartyTypeKind(){return ne},coerce:eHt,any:P8t,array:R8t,bigint:S8t,boolean:k1e,date:x8t,discriminatedUnion:N8t,effect:T1e,enum:H8t,function:q8t,instanceof:v8t,intersection:L8t,lazy:U8t,literal:z8t,map:B8t,nan:w8t,nativeEnum:V8t,never:M8t,null:E8t,nullable:G8t,number:F1e,object:I8t,oboolean:Q8t,onumber:Z8t,optional:J8t,ostring:X8t,pipeline:Y8t,preprocess:K8t,promise:W8t,record:k8t,set:$8t,strictObject:D8t,string:L1e,symbol:C8t,transformer:T1e,tuple:F8t,undefined:O8t,union:j8t,unknown:T8t,void:A8t,NEVER:tHt,ZodIssueCode:we,quotelessJson:G3t,ZodError:Od})});var $1e=b((Fmn,B1e)=>{function ih(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}B1e.exports=ih;ih.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};ih.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};ih.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};ih.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ih.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};ih.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};ih.prototype.start=ih.prototype.try;ih.prototype.errors=function(){return this._errors};ih.prototype.attempts=function(){return this._attempts};ih.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var q1e=b(cA=>{var rHt=$1e();cA.operation=function(t){var e=cA.timeouts(t);return new rHt(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};cA.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};cA.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};cA.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var l=cA.operation(e),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(f){l.retry(f)||(f&&(arguments[0]=l.mainError()),d.apply(this,arguments))}),l.attempt(function(){u.apply(t,c)})}.bind(t,a),t[i].options=e}}});var z1e=b((Bmn,U1e)=>{U1e.exports=q1e()});var yV=b(($mn,gV)=>{"use strict";var nHt=z1e(),oHt=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],mV=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},iHt=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},aHt=t=>oHt.includes(t),H1e=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=nHt.operation(e);o.attempt(async i=>{try{r(await t(i))}catch(a){if(!(a instanceof Error)){n(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof mV)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!aHt(a.message))o.stop(),n(a);else{iHt(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});gV.exports=H1e;gV.exports.default=H1e;gV.exports.AbortError=mV});var V1e,W1e=C(()=>{V1e=/^(?:[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 sHt(t){return typeof t=="string"&&V1e.test(t)}var gj,J1e=C(()=>{W1e();gj=sHt});function G1e(t,e=0){return(Wl[t[e+0]]+Wl[t[e+1]]+Wl[t[e+2]]+Wl[t[e+3]]+"-"+Wl[t[e+4]]+Wl[t[e+5]]+"-"+Wl[t[e+6]]+Wl[t[e+7]]+"-"+Wl[t[e+8]]+Wl[t[e+9]]+"-"+Wl[t[e+10]]+Wl[t[e+11]]+Wl[t[e+12]]+Wl[t[e+13]]+Wl[t[e+14]]+Wl[t[e+15]]).toLowerCase()}var Wl,bV,K1e=C(()=>{Wl=[];for(bV=0;bV<256;++bV)Wl.push((bV+256).toString(16).slice(1))});function Hae(){if(!_V&&(_V=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_V))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _V(uHt)}var _V,uHt,Y1e=C(()=>{uHt=new Uint8Array(16)});var lHt,Vae,X1e=C(()=>{lHt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vae={randomUUID:lHt}});function cHt(t,e,r){if(Vae.randomUUID&&!e&&!t)return Vae.randomUUID();t=t||{};var n=t.random||(t.rng||Hae)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return G1e(n)}var af,Z1e=C(()=>{X1e();Y1e();K1e();af=cHt});var _q=C(()=>{Z1e();J1e()});var Q1e,eDe=C(()=>{Q1e=/^(?:[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 fHt(t){return typeof t=="string"&&Q1e.test(t)}var Wae,tDe=C(()=>{eDe();Wae=fHt});function rDe(t,e=0){return(Jl[t[e+0]]+Jl[t[e+1]]+Jl[t[e+2]]+Jl[t[e+3]]+"-"+Jl[t[e+4]]+Jl[t[e+5]]+"-"+Jl[t[e+6]]+Jl[t[e+7]]+"-"+Jl[t[e+8]]+Jl[t[e+9]]+"-"+Jl[t[e+10]]+Jl[t[e+11]]+Jl[t[e+12]]+Jl[t[e+13]]+Jl[t[e+14]]+Jl[t[e+15]]).toLowerCase()}var Jl,vV,nDe=C(()=>{Jl=[];for(vV=0;vV<256;++vV)Jl.push((vV+256).toString(16).slice(1))});function Jae(){if(!wV&&(wV=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wV))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wV(pHt)}var wV,pHt,oDe=C(()=>{pHt=new Uint8Array(16)});var hHt,Gae,iDe=C(()=>{hHt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gae={randomUUID:hHt}});function mHt(t,e,r){if(Gae.randomUUID&&!e&&!t)return Gae.randomUUID();t=t||{};var n=t.random||(t.rng||Jae)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return rDe(n)}var GO,aDe=C(()=>{iDe();oDe();nDe();GO=mHt});var SV=C(()=>{aDe();tDe()});var uDe=b((dgn,Yae)=>{"use strict";var gHt=Object.prototype.hasOwnProperty,Td="~";function vq(){}Object.create&&(vq.prototype=Object.create(null),new vq().__proto__||(Td=!1));function yHt(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function sDe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new yHt(r,n||t,o),a=Td?Td+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],i]:t._events[a].push(i):(t._events[a]=i,t._eventsCount++),t}function xV(t,e){--t._eventsCount===0?t._events=new vq:delete t._events[e]}function $c(){this._events=new vq,this._eventsCount=0}$c.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)gHt.call(r,n)&&e.push(Td?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};$c.prototype.listeners=function(e){var r=Td?Td+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a};$c.prototype.listenerCount=function(e){var r=Td?Td+e:e,n=this._events[r];return n?n.fn?1:n.length:0};$c.prototype.emit=function(e,r,n,o,i,a){var s=Td?Td+e:e;if(!this._events[s])return!1;var u=this._events[s],l=arguments.length,c,d;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,o),!0;case 5:return u.fn.call(u.context,r,n,o,i),!0;case 6:return u.fn.call(u.context,r,n,o,i,a),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var f=u.length,p;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,r);break;case 3:u[d].fn.call(u[d].context,r,n);break;case 4:u[d].fn.call(u[d].context,r,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[d].fn.apply(u[d].context,c)}}return!0};$c.prototype.on=function(e,r,n){return sDe(this,e,r,n,!1)};$c.prototype.once=function(e,r,n){return sDe(this,e,r,n,!0)};$c.prototype.removeListener=function(e,r,n,o){var i=Td?Td+e:e;if(!this._events[i])return this;if(!r)return xV(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&xV(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:xV(this,i)}return this};$c.prototype.removeAllListeners=function(e){var r;return e?(r=Td?Td+e:e,this._events[r]&&xV(this,r)):(this._events=new vq,this._eventsCount=0),this};$c.prototype.off=$c.prototype.removeListener;$c.prototype.addListener=$c.prototype.on;$c.prefixed=Td;$c.EventEmitter=$c;typeof Yae<"u"&&(Yae.exports=$c)});var cDe=b((fgn,lDe)=>{"use strict";lDe.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var fDe=b((pgn,OV)=>{"use strict";var bHt=cDe(),CV=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dDe=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(u){o(u)}return}let a=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,s=r instanceof Error?r:new CV(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);bHt(t.then(n,o),()=>{clearTimeout(i)})});OV.exports=dDe;OV.exports.default=dDe;OV.exports.TimeoutError=CV});var pDe=b(Xae=>{"use strict";Object.defineProperty(Xae,"__esModule",{value:!0});function _Ht(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,a=n+i;r(t[a],e)<=0?(n=++a,o-=i+1):o=i}return n}Xae.default=_Ht});var hDe=b(Qae=>{"use strict";Object.defineProperty(Qae,"__esModule",{value:!0});var vHt=pDe(),Zae=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=vHt.default(this._queue,n,(i,a)=>a.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Qae.default=Zae});var PV=b(tse=>{"use strict";Object.defineProperty(tse,"__esModule",{value:!0});var wHt=uDe(),mDe=fDe(),SHt=hDe(),EV=()=>{},xHt=new mDe.TimeoutError,ese=class extends wHt{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=EV,this._resolveIdle=EV,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:SHt.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=EV,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=EV,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let a=this._timeout===void 0&&r.timeout===void 0?e():mDe.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(xHt)});n(await a)}catch(a){o(a)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};tse.default=ese});var CHt,OHt,xt,TV=C(()=>{CHt=(...t)=>fetch(...t),OHt=Symbol.for("ls:fetch_implementation"),xt=()=>globalThis[OHt]??CHt});var gDe,MV,EHt,PHt,wq,yDe=C(()=>{gDe=B(yV(),1),MV=B(PV(),1);TV();EHt=[400,401,403,404,405,406,407,408],PHt=[409],wq=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,"default"in MV.default?this.queue=new MV.default.default({concurrency:this.maxConcurrency}):this.queue=new MV.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,gDe.default)(()=>e(...r).catch(o=>{throw o instanceof Error?o:new Error(o)}),{async onFailedAttempt(o){if(o.message.startsWith("Cancel")||o.message.startsWith("TimeoutError")||o.message.startsWith("AbortError")||o?.code==="ECONNABORTED")throw o;let i=o?.response,a=i?.status;if(a){if(EHt.includes(+a))throw o;if(PHt.includes(+a))return;n&&await n(i)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>xt()(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function rse(t){return typeof t?._getType=="function"}function nse(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var bDe=C(()=>{});function Zr(t,e){if(!Wae(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var _De=C(()=>{SV()});function AV(t){vDe[t]||(console.warn(t),vDe[t]=!0)}var vDe,ose=C(()=>{vDe={}});var Sq=b((xgn,wDe)=>{var THt="2.0.0",MHt=Number.MAX_SAFE_INTEGER||9007199254740991,AHt=16,RHt=256-6,IHt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];wDe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:AHt,MAX_SAFE_BUILD_LENGTH:RHt,MAX_SAFE_INTEGER:MHt,RELEASE_TYPES:IHt,SEMVER_SPEC_VERSION:THt,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var xq=b((Cgn,SDe)=>{var DHt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};SDe.exports=DHt});var yj=b((KS,xDe)=>{var{MAX_SAFE_COMPONENT_LENGTH:ise,MAX_SAFE_BUILD_LENGTH:jHt,MAX_LENGTH:NHt}=Sq(),LHt=xq();KS=xDe.exports={};var FHt=KS.re=[],kHt=KS.safeRe=[],rt=KS.src=[],nt=KS.t={},BHt=0,ase="[a-zA-Z0-9-]",$Ht=[["\\s",1],["\\d",NHt],[ase,jHt]],qHt=t=>{for(let[e,r]of $Ht)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},pr=(t,e,r)=>{let n=qHt(e),o=BHt++;LHt(t,o,e),nt[t]=o,rt[o]=e,FHt[o]=new RegExp(e,r?"g":void 0),kHt[o]=new RegExp(n,r?"g":void 0)};pr("NUMERICIDENTIFIER","0|[1-9]\\d*");pr("NUMERICIDENTIFIERLOOSE","\\d+");pr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ase}*`);pr("MAINVERSION",`(${rt[nt.NUMERICIDENTIFIER]})\\.(${rt[nt.NUMERICIDENTIFIER]})\\.(${rt[nt.NUMERICIDENTIFIER]})`);pr("MAINVERSIONLOOSE",`(${rt[nt.NUMERICIDENTIFIERLOOSE]})\\.(${rt[nt.NUMERICIDENTIFIERLOOSE]})\\.(${rt[nt.NUMERICIDENTIFIERLOOSE]})`);pr("PRERELEASEIDENTIFIER",`(?:${rt[nt.NUMERICIDENTIFIER]}|${rt[nt.NONNUMERICIDENTIFIER]})`);pr("PRERELEASEIDENTIFIERLOOSE",`(?:${rt[nt.NUMERICIDENTIFIERLOOSE]}|${rt[nt.NONNUMERICIDENTIFIER]})`);pr("PRERELEASE",`(?:-(${rt[nt.PRERELEASEIDENTIFIER]}(?:\\.${rt[nt.PRERELEASEIDENTIFIER]})*))`);pr("PRERELEASELOOSE",`(?:-?(${rt[nt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${rt[nt.PRERELEASEIDENTIFIERLOOSE]})*))`);pr("BUILDIDENTIFIER",`${ase}+`);pr("BUILD",`(?:\\+(${rt[nt.BUILDIDENTIFIER]}(?:\\.${rt[nt.BUILDIDENTIFIER]})*))`);pr("FULLPLAIN",`v?${rt[nt.MAINVERSION]}${rt[nt.PRERELEASE]}?${rt[nt.BUILD]}?`);pr("FULL",`^${rt[nt.FULLPLAIN]}$`);pr("LOOSEPLAIN",`[v=\\s]*${rt[nt.MAINVERSIONLOOSE]}${rt[nt.PRERELEASELOOSE]}?${rt[nt.BUILD]}?`);pr("LOOSE",`^${rt[nt.LOOSEPLAIN]}$`);pr("GTLT","((?:<|>)?=?)");pr("XRANGEIDENTIFIERLOOSE",`${rt[nt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pr("XRANGEIDENTIFIER",`${rt[nt.NUMERICIDENTIFIER]}|x|X|\\*`);pr("XRANGEPLAIN",`[v=\\s]*(${rt[nt.XRANGEIDENTIFIER]})(?:\\.(${rt[nt.XRANGEIDENTIFIER]})(?:\\.(${rt[nt.XRANGEIDENTIFIER]})(?:${rt[nt.PRERELEASE]})?${rt[nt.BUILD]}?)?)?`);pr("XRANGEPLAINLOOSE",`[v=\\s]*(${rt[nt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${rt[nt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${rt[nt.XRANGEIDENTIFIERLOOSE]})(?:${rt[nt.PRERELEASELOOSE]})?${rt[nt.BUILD]}?)?)?`);pr("XRANGE",`^${rt[nt.GTLT]}\\s*${rt[nt.XRANGEPLAIN]}$`);pr("XRANGELOOSE",`^${rt[nt.GTLT]}\\s*${rt[nt.XRANGEPLAINLOOSE]}$`);pr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ise}})(?:\\.(\\d{1,${ise}}))?(?:\\.(\\d{1,${ise}}))?`);pr("COERCE",`${rt[nt.COERCEPLAIN]}(?:$|[^\\d])`);pr("COERCEFULL",rt[nt.COERCEPLAIN]+`(?:${rt[nt.PRERELEASE]})?(?:${rt[nt.BUILD]})?(?:$|[^\\d])`);pr("COERCERTL",rt[nt.COERCE],!0);pr("COERCERTLFULL",rt[nt.COERCEFULL],!0);pr("LONETILDE","(?:~>?)");pr("TILDETRIM",`(\\s*)${rt[nt.LONETILDE]}\\s+`,!0);KS.tildeTrimReplace="$1~";pr("TILDE",`^${rt[nt.LONETILDE]}${rt[nt.XRANGEPLAIN]}$`);pr("TILDELOOSE",`^${rt[nt.LONETILDE]}${rt[nt.XRANGEPLAINLOOSE]}$`);pr("LONECARET","(?:\\^)");pr("CARETTRIM",`(\\s*)${rt[nt.LONECARET]}\\s+`,!0);KS.caretTrimReplace="$1^";pr("CARET",`^${rt[nt.LONECARET]}${rt[nt.XRANGEPLAIN]}$`);pr("CARETLOOSE",`^${rt[nt.LONECARET]}${rt[nt.XRANGEPLAINLOOSE]}$`);pr("COMPARATORLOOSE",`^${rt[nt.GTLT]}\\s*(${rt[nt.LOOSEPLAIN]})$|^$`);pr("COMPARATOR",`^${rt[nt.GTLT]}\\s*(${rt[nt.FULLPLAIN]})$|^$`);pr("COMPARATORTRIM",`(\\s*)${rt[nt.GTLT]}\\s*(${rt[nt.LOOSEPLAIN]}|${rt[nt.XRANGEPLAIN]})`,!0);KS.comparatorTrimReplace="$1$2$3";pr("HYPHENRANGE",`^\\s*(${rt[nt.XRANGEPLAIN]})\\s+-\\s+(${rt[nt.XRANGEPLAIN]})\\s*$`);pr("HYPHENRANGELOOSE",`^\\s*(${rt[nt.XRANGEPLAINLOOSE]})\\s+-\\s+(${rt[nt.XRANGEPLAINLOOSE]})\\s*$`);pr("STAR","(<|>)?=?\\s*\\*");pr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var RV=b((Ogn,CDe)=>{var UHt=Object.freeze({loose:!0}),zHt=Object.freeze({}),HHt=t=>t?typeof t!="object"?UHt:t:zHt;CDe.exports=HHt});var sse=b((Egn,PDe)=>{var ODe=/^[0-9]+$/,EDe=(t,e)=>{let r=ODe.test(t),n=ODe.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},VHt=(t,e)=>EDe(e,t);PDe.exports={compareIdentifiers:EDe,rcompareIdentifiers:VHt}});var qc=b((Pgn,RDe)=>{var IV=xq(),{MAX_LENGTH:TDe,MAX_SAFE_INTEGER:DV}=Sq(),{safeRe:MDe,t:ADe}=yj(),WHt=RV(),{compareIdentifiers:bj}=sse(),ip=class{constructor(e,r){if(r=WHt(r),e instanceof ip){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>TDe)throw new TypeError(`version is longer than ${TDe} characters`);IV("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?MDe[ADe.LOOSE]:MDe[ADe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>DV||this.major<0)throw new TypeError("Invalid major version");if(this.minor>DV||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>DV||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<DV)return i}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(IV("SemVer.compare",this.version,this.options,e),!(e instanceof ip)){if(typeof e=="string"&&e===this.version)return 0;e=new ip(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof ip||(e=new ip(e,this.options)),bj(this.major,e.major)||bj(this.minor,e.minor)||bj(this.patch,e.patch)}comparePre(e){if(e instanceof ip||(e=new ip(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(IV("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 bj(n,o)}while(++r)}compareBuild(e){e instanceof ip||(e=new ip(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(IV("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 bj(n,o)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),bj(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};RDe.exports=ip});var dA=b((Tgn,DDe)=>{var IDe=qc(),JHt=(t,e,r=!1)=>{if(t instanceof IDe)return t;try{return new IDe(t,e)}catch(n){if(!r)return null;throw n}};DDe.exports=JHt});var NDe=b((Mgn,jDe)=>{var GHt=dA(),KHt=(t,e)=>{let r=GHt(t,e);return r?r.version:null};jDe.exports=KHt});var FDe=b((Agn,LDe)=>{var YHt=dA(),XHt=(t,e)=>{let r=YHt(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};LDe.exports=XHt});var $De=b((Rgn,BDe)=>{var kDe=qc(),ZHt=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new kDe(t instanceof kDe?t.version:t,r).inc(e,n,o).version}catch{return null}};BDe.exports=ZHt});var zDe=b((Ign,UDe)=>{var qDe=dA(),QHt=(t,e)=>{let r=qDe(t,null,!0),n=qDe(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,a=i?r:n,s=i?n:r,u=!!a.prerelease.length;if(!!s.prerelease.length&&!u)return!s.patch&&!s.minor?"major":a.patch?"patch":a.minor?"minor":"major";let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};UDe.exports=QHt});var VDe=b((Dgn,HDe)=>{var e6t=qc(),t6t=(t,e)=>new e6t(t,e).major;HDe.exports=t6t});var JDe=b((jgn,WDe)=>{var r6t=qc(),n6t=(t,e)=>new r6t(t,e).minor;WDe.exports=n6t});var KDe=b((Ngn,GDe)=>{var o6t=qc(),i6t=(t,e)=>new o6t(t,e).patch;GDe.exports=i6t});var XDe=b((Lgn,YDe)=>{var a6t=dA(),s6t=(t,e)=>{let r=a6t(t,e);return r&&r.prerelease.length?r.prerelease:null};YDe.exports=s6t});var ah=b((Fgn,QDe)=>{var ZDe=qc(),u6t=(t,e,r)=>new ZDe(t,r).compare(new ZDe(e,r));QDe.exports=u6t});var tje=b((kgn,eje)=>{var l6t=ah(),c6t=(t,e,r)=>l6t(e,t,r);eje.exports=c6t});var nje=b((Bgn,rje)=>{var d6t=ah(),f6t=(t,e)=>d6t(t,e,!0);rje.exports=f6t});var jV=b(($gn,ije)=>{var oje=qc(),p6t=(t,e,r)=>{let n=new oje(t,r),o=new oje(e,r);return n.compare(o)||n.compareBuild(o)};ije.exports=p6t});var sje=b((qgn,aje)=>{var h6t=jV(),m6t=(t,e)=>t.sort((r,n)=>h6t(r,n,e));aje.exports=m6t});var lje=b((Ugn,uje)=>{var g6t=jV(),y6t=(t,e)=>t.sort((r,n)=>g6t(n,r,e));uje.exports=y6t});var Cq=b((zgn,cje)=>{var b6t=ah(),_6t=(t,e,r)=>b6t(t,e,r)>0;cje.exports=_6t});var NV=b((Hgn,dje)=>{var v6t=ah(),w6t=(t,e,r)=>v6t(t,e,r)<0;dje.exports=w6t});var use=b((Vgn,fje)=>{var S6t=ah(),x6t=(t,e,r)=>S6t(t,e,r)===0;fje.exports=x6t});var lse=b((Wgn,pje)=>{var C6t=ah(),O6t=(t,e,r)=>C6t(t,e,r)!==0;pje.exports=O6t});var LV=b((Jgn,hje)=>{var E6t=ah(),P6t=(t,e,r)=>E6t(t,e,r)>=0;hje.exports=P6t});var FV=b((Ggn,mje)=>{var T6t=ah(),M6t=(t,e,r)=>T6t(t,e,r)<=0;mje.exports=M6t});var cse=b((Kgn,gje)=>{var A6t=use(),R6t=lse(),I6t=Cq(),D6t=LV(),j6t=NV(),N6t=FV(),L6t=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return A6t(t,r,n);case"!=":return R6t(t,r,n);case">":return I6t(t,r,n);case">=":return D6t(t,r,n);case"<":return j6t(t,r,n);case"<=":return N6t(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};gje.exports=L6t});var bje=b((Ygn,yje)=>{var F6t=qc(),k6t=dA(),{safeRe:kV,t:BV}=yj(),B6t=(t,e)=>{if(t instanceof F6t)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?kV[BV.COERCEFULL]:kV[BV.COERCE]);else{let u=e.includePrerelease?kV[BV.COERCERTLFULL]:kV[BV.COERCERTL],l;for(;(l=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),u.lastIndex=l.index+l[1].length+l[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",a=e.includePrerelease&&r[5]?`-${r[5]}`:"",s=e.includePrerelease&&r[6]?`+${r[6]}`:"";return k6t(`${n}.${o}.${i}${a}${s}`,e)};yje.exports=B6t});var vje=b((Xgn,_je)=>{var dse=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};_je.exports=dse});var sh=b((Zgn,Cje)=>{var $6t=/\s+/g,fA=class{constructor(e,r){if(r=U6t(r),e instanceof fA)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new fA(e.raw,r);if(e instanceof fse)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace($6t," "),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=>!Sje(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&&K6t(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&J6t)|(this.options.loose&&G6t))+":"+e,o=wje.get(n);if(o)return o;let i=this.options.loose,a=i?sf[Md.HYPHENRANGELOOSE]:sf[Md.HYPHENRANGE];e=e.replace(a,iVt(this.options.includePrerelease)),bi("hyphen replace",e),e=e.replace(sf[Md.COMPARATORTRIM],H6t),bi("comparator trim",e),e=e.replace(sf[Md.TILDETRIM],V6t),bi("tilde trim",e),e=e.replace(sf[Md.CARETTRIM],W6t),bi("caret trim",e);let s=e.split(" ").map(d=>Y6t(d,this.options)).join(" ").split(/\s+/).map(d=>oVt(d,this.options));i&&(s=s.filter(d=>(bi("loose invalid filter",d,this.options),!!d.match(sf[Md.COMPARATORLOOSE])))),bi("range list",s);let u=new Map,l=s.map(d=>new fse(d,this.options));for(let d of l){if(Sje(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(e,r){if(!(e instanceof fA))throw new TypeError("a Range is required");return this.set.some(n=>xje(n,r)&&e.set.some(o=>xje(o,r)&&n.every(i=>o.every(a=>i.intersects(a,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new z6t(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(aVt(this.set[r],e,this.options))return!0;return!1}};Cje.exports=fA;var q6t=vje(),wje=new q6t,U6t=RV(),fse=Oq(),bi=xq(),z6t=qc(),{safeRe:sf,t:Md,comparatorTrimReplace:H6t,tildeTrimReplace:V6t,caretTrimReplace:W6t}=yj(),{FLAG_INCLUDE_PRERELEASE:J6t,FLAG_LOOSE:G6t}=Sq(),Sje=t=>t.value==="<0.0.0-0",K6t=t=>t.value==="",xje=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},Y6t=(t,e)=>(bi("comp",t,e),t=Q6t(t,e),bi("caret",t),t=X6t(t,e),bi("tildes",t),t=tVt(t,e),bi("xrange",t),t=nVt(t,e),bi("stars",t),t),Ad=t=>!t||t.toLowerCase()==="x"||t==="*",X6t=(t,e)=>t.trim().split(/\s+/).map(r=>Z6t(r,e)).join(" "),Z6t=(t,e)=>{let r=e.loose?sf[Md.TILDELOOSE]:sf[Md.TILDE];return t.replace(r,(n,o,i,a,s)=>{bi("tilde",t,n,o,i,a,s);let u;return Ad(o)?u="":Ad(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Ad(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(bi("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,bi("tilde return",u),u})},Q6t=(t,e)=>t.trim().split(/\s+/).map(r=>eVt(r,e)).join(" "),eVt=(t,e)=>{bi("caret",t,e);let r=e.loose?sf[Md.CARETLOOSE]:sf[Md.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{bi("caret",t,o,i,a,s,u);let l;return Ad(i)?l="":Ad(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Ad(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(bi("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`):(bi("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`),bi("caret return",l),l})},tVt=(t,e)=>(bi("replaceXRanges",t,e),t.split(/\s+/).map(r=>rVt(r,e)).join(" ")),rVt=(t,e)=>{t=t.trim();let r=e.loose?sf[Md.XRANGELOOSE]:sf[Md.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{bi("xRange",t,n,o,i,a,s,u);let l=Ad(i),c=l||Ad(a),d=c||Ad(s),f=d;return o==="="&&f&&(o=""),u=e.includePrerelease?"-0":"",l?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(c&&(a=0),s=0,o===">"?(o=">=",c?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):o==="<="&&(o="<",c?i=+i+1:a=+a+1),o==="<"&&(u="-0"),n=`${o+i}.${a}.${s}${u}`):c?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${u} <${i}.${+a+1}.0-0`),bi("xRange return",n),n})},nVt=(t,e)=>(bi("replaceStars",t,e),t.trim().replace(sf[Md.STAR],"")),oVt=(t,e)=>(bi("replaceGTE0",t,e),t.trim().replace(sf[e.includePrerelease?Md.GTE0PRE:Md.GTE0],"")),iVt=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Ad(n)?r="":Ad(o)?r=`>=${n}.0.0${t?"-0":""}`:Ad(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Ad(l)?u="":Ad(c)?u=`<${+l+1}.0.0-0`:Ad(d)?u=`<${l}.${+c+1}.0-0`:f?u=`<=${l}.${c}.${d}-${f}`:t?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),aVt=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(bi(t[n].semver),t[n].semver!==fse.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var Oq=b((Qgn,Aje)=>{var Eq=Symbol("SemVer ANY"),_j=class{static get ANY(){return Eq}constructor(e,r){if(r=Oje(r),e instanceof _j){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),hse("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Eq?this.value="":this.value=this.operator+this.semver.version,hse("comp",this)}parse(e){let r=this.options.loose?Eje[Pje.COMPARATORLOOSE]:Eje[Pje.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Tje(n[2],this.options.loose):this.semver=Eq}toString(){return this.value}test(e){if(hse("Comparator.test",e,this.options.loose),this.semver===Eq||e===Eq)return!0;if(typeof e=="string")try{e=new Tje(e,this.options)}catch{return!1}return pse(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof _j))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Mje(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Mje(this.value,r).test(e.semver):(r=Oje(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||pse(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||pse(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Aje.exports=_j;var Oje=RV(),{safeRe:Eje,t:Pje}=yj(),pse=cse(),hse=xq(),Tje=qc(),Mje=sh()});var Pq=b((eyn,Rje)=>{var sVt=sh(),uVt=(t,e,r)=>{try{e=new sVt(e,r)}catch{return!1}return e.test(t)};Rje.exports=uVt});var Dje=b((tyn,Ije)=>{var lVt=sh(),cVt=(t,e)=>new lVt(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Ije.exports=cVt});var Nje=b((ryn,jje)=>{var dVt=qc(),fVt=sh(),pVt=(t,e,r)=>{let n=null,o=null,i=null;try{i=new fVt(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new dVt(n,r))}),n};jje.exports=pVt});var Fje=b((nyn,Lje)=>{var hVt=qc(),mVt=sh(),gVt=(t,e,r)=>{let n=null,o=null,i=null;try{i=new mVt(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new hVt(n,r))}),n};Lje.exports=gVt});var $je=b((oyn,Bje)=>{var mse=qc(),yVt=sh(),kje=Cq(),bVt=(t,e)=>{t=new yVt(t,e);let r=new mse("0.0.0");if(t.test(r)||(r=new mse("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],i=null;o.forEach(a=>{let s=new 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||kje(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||kje(r,i))&&(r=i)}return r&&t.test(r)?r:null};Bje.exports=bVt});var Uje=b((iyn,qje)=>{var _Vt=sh(),vVt=(t,e)=>{try{return new _Vt(t,e).range||"*"}catch{return null}};qje.exports=vVt});var $V=b((ayn,Wje)=>{var wVt=qc(),Vje=Oq(),{ANY:SVt}=Vje,xVt=sh(),CVt=Pq(),zje=Cq(),Hje=NV(),OVt=FV(),EVt=LV(),PVt=(t,e,r,n)=>{t=new wVt(t,n),e=new xVt(e,n);let o,i,a,s,u;switch(r){case">":o=zje,i=OVt,a=Hje,s=">",u=">=";break;case"<":o=Hje,i=EVt,a=zje,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(CVt(t,e,n))return!1;for(let l=0;l<e.set.length;++l){let c=e.set[l],d=null,f=null;if(c.forEach(p=>{p.semver===SVt&&(p=new Vje(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:a(p.semver,f.semver,n)&&(f=p)}),d.operator===s||d.operator===u||(!f.operator||f.operator===s)&&i(t,f.semver))return!1;if(f.operator===u&&a(t,f.semver))return!1}return!0};Wje.exports=PVt});var Gje=b((syn,Jje)=>{var TVt=$V(),MVt=(t,e,r)=>TVt(t,e,">",r);Jje.exports=MVt});var Yje=b((uyn,Kje)=>{var AVt=$V(),RVt=(t,e,r)=>AVt(t,e,"<",r);Kje.exports=RVt});var Qje=b((lyn,Zje)=>{var Xje=sh(),IVt=(t,e,r)=>(t=new Xje(t,r),e=new Xje(e,r),t.intersects(e,r));Zje.exports=IVt});var tNe=b((cyn,eNe)=>{var DVt=Pq(),jVt=ah();eNe.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>jVt(c,d,r));for(let c of a)DVt(c,e,r)?(i=c,o||(o=c)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let s=[];for(let[c,d]of n)c===d?s.push(c):!d&&c===a[0]?s.push("*"):d?c===a[0]?s.push(`<=${d}`):s.push(`${c} - ${d}`):s.push(`>=${c}`);let u=s.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return u.length<l.length?u:e}});var sNe=b((dyn,aNe)=>{var rNe=sh(),yse=Oq(),{ANY:gse}=yse,Tq=Pq(),bse=ah(),NVt=(t,e,r={})=>{if(t===e)return!0;t=new rNe(t,r),e=new rNe(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=FVt(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},LVt=[new yse(">=0.0.0-0")],nNe=[new yse(">=0.0.0")],FVt=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===gse){if(e.length===1&&e[0].semver===gse)return!0;r.includePrerelease?t=LVt:t=nNe}if(e.length===1&&e[0].semver===gse){if(r.includePrerelease)return!0;e=nNe}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=oNe(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&&!Tq(p,String(o),r)||i&&!Tq(p,String(i),r))return null;for(let h of e)if(!Tq(p,String(h),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=oNe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!Tq(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==="<="&&!Tq(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)},oNe=(t,e,r)=>{if(!t)return e;let n=bse(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},iNe=(t,e,r)=>{if(!t)return e;let n=bse(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};aNe.exports=NVt});var dNe=b((fyn,cNe)=>{var _se=yj(),uNe=Sq(),kVt=qc(),lNe=sse(),BVt=dA(),$Vt=NDe(),qVt=FDe(),UVt=$De(),zVt=zDe(),HVt=VDe(),VVt=JDe(),WVt=KDe(),JVt=XDe(),GVt=ah(),KVt=tje(),YVt=nje(),XVt=jV(),ZVt=sje(),QVt=lje(),e5t=Cq(),t5t=NV(),r5t=use(),n5t=lse(),o5t=LV(),i5t=FV(),a5t=cse(),s5t=bje(),u5t=Oq(),l5t=sh(),c5t=Pq(),d5t=Dje(),f5t=Nje(),p5t=Fje(),h5t=$je(),m5t=Uje(),g5t=$V(),y5t=Gje(),b5t=Yje(),_5t=Qje(),v5t=tNe(),w5t=sNe();cNe.exports={parse:BVt,valid:$Vt,clean:qVt,inc:UVt,diff:zVt,major:HVt,minor:VVt,patch:WVt,prerelease:JVt,compare:GVt,rcompare:KVt,compareLoose:YVt,compareBuild:XVt,sort:ZVt,rsort:QVt,gt:e5t,lt:t5t,eq:r5t,neq:n5t,gte:o5t,lte:i5t,cmp:a5t,coerce:s5t,Comparator:u5t,Range:l5t,satisfies:c5t,toComparators:d5t,maxSatisfying:f5t,minSatisfying:p5t,minVersion:h5t,validRange:m5t,outside:g5t,gtr:y5t,ltr:b5t,intersects:_5t,simplifyRange:v5t,subset:w5t,SemVer:kVt,re:_se.re,src:_se.src,tokens:_se.t,SEMVER_SPEC_VERSION:uNe.SEMVER_SPEC_VERSION,RELEASE_TYPES:uNe.RELEASE_TYPES,compareIdentifiers:lNe.compareIdentifiers,rcompareIdentifiers:lNe.rcompareIdentifiers}});function YS(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var S5t,fNe=C(()=>{S5t=B(dNe(),1)});async function Ur(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}n=await t.text();let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Server response: ${n}`;throw t.status===409?new vse(o):new Error(o)}var vse,pNe=C(()=>{vse=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function C5t(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function uf(t,e,r,n){try{return JSON.stringify(t,e,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=C5t()),Sse(t,"",0,[],void 0,0,n);var o;try{vj.length===0?o=JSON.stringify(t,e,r):o=JSON.stringify(t,O5t(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;qV.length!==0;){var i=qV.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return o}}function wse(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),qV.push([n,r,e,o])):vj.push([e,r,t]):(n[r]=t,qV.push([n,r,e]))}function Sse(t,e,r,n,o,i,a){i+=1;var s;if(typeof t=="object"&&t!==null){for(s=0;s<n.length;s++)if(n[s]===t){wse(x5t,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){wse(hNe,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){wse(hNe,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Sse(t[s],s,s,n,t,i,a);else{var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];Sse(t[l],l,s,n,t,i,a)}}n.pop()}}function O5t(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(vj.length>0)for(var n=0;n<vj.length;n++){var o=vj[n];if(o[1]===e&&o[0]===r){r=o[2],vj.splice(n,1);break}}return t.call(this,e,r)}}var hNe,x5t,qV,vj,mNe=C(()=>{hNe="[...]",x5t={result:"[Circular]"},qV=[],vj=[]});function gNe(t){let e=HV(),r=yNe(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||t.revision_id?{revision_id:t.revision_id??r.revision_id}:{},...o}},t}async function T5t(t){let e=[];for await(let r of t)e.push(r);return e}function xse(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var E5t,P5t,M5t,Cse,A5t,R5t,Sy,Ose=C(()=>{SV();yDe();bDe();VV();zV();_De();ose();fNe();pNe();TV();mNe();E5t=()=>{let t=XS("TRACING_SAMPLING_RATE");if(t===void 0)return;let e=parseFloat(t);if(e<0||e>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${e}`);return e},P5t=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};M5t=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"30",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1},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(e){let r,n=new Promise(i=>{r=i}),o=uf(e.item).length;return this.items.push({action:e.action,payload:e.item,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(e){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],n=0;for(;n+(this.peek()?.size??0)<e&&this.items.length>0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload})),()=>r.forEach(o=>o.itemPromiseResolve())]}},A5t=20971520,R5t=2500,Sy=class{constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:new 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:xy("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1});let r=Sy.getDefaultClientConfig();if(this.tracingSampleRate=E5t(),this.apiUrl=xse(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=xse(e.apiKey??r.apiKey),this.webUrl=xse(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new wq(e.callerOptions??{}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.batchIngestCaller=new wq({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:M5t}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let e=XS("API_KEY"),r=XS("ENDPOINT")??"https://api.smith.langchain.com",n=XS("HIDE_INPUTS")==="true",o=XS("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:P5t(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 e={"User-Agent":`langsmith-js/${UV}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(xt(),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(i,`Failed to fetch ${e}`),i}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let a=`${this.apiUrl}${e}?${r}`,s=await this.caller.call(xt(),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(s,`Failed to fetch ${e}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length<i))break;o+=u.length}}async*_getCursorPaginatedList(e,r=null,n="POST",o="runs"){let i=r?{...r}:{};for(;;){let s=await(await this.caller.call(xt(),`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)})).json();if(!s||!s[o])break;yield s[o];let u=s.cursors;if(!u||!u.next)break;i.cursor=u.next}}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.id)?this.filteredPostUuids.delete(o.id):n.push(o);return n}else{let n=[];for(let o of e)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 e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e.batch_ingest_config?.size_limit_bytes??A5t}async _getMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue(e){let r=[];for(;this.autoBatchQueue.items.length>0;){let[n,o]=this.autoBatchQueue.pop(e);if(!n.length){o();break}let i=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(e,r){if(!e.length){r();return}try{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)};(await this._ensureServerInfo())?.batch_ingest_config?.use_multipart_endpoint?await this.multipartIngestRuns(n):await this.batchIngestRuns(n)}finally{r()}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.action==="create"&&(e.item=gNe(e.item));let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes();return this.autoBatchQueue.sizeBytes>n&&this.drainAutoBatchQueue(n),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue(n)},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let e=await xt()(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(R5t),...this.fetchOptions});return await Ur(e,"get server info"),e.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(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=gNe(o),a=await this.caller.call(xt(),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:uf(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=e?.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(uf(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(xt(),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=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:v,...g}=f,_={inputs:p,outputs:h,events:m},S=uf(g);l.push({name:`${c}.${g.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[x,O]of Object.entries(_)){if(O===void 0)continue;let T=uf(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(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r
`])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r
`,`Content-Type: ${u.payload.type}\r
\r
`])),o.push(u.payload),o.push(new Blob([`\r
`]));o.push(new Blob([`--${n}--\r
`]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(xt(),`${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 Ur(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()}
Context: ${r}`)}}async updateRun(e,r){Zr(e),r.inputs&&(r.inputs=this.processInputs(r.inputs)),r.outputs&&(r.outputs=this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(xt(),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:uf(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(i,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Zr(e);let n=await this._get(`/runs/${e}`);return r&&n.child_run_ids&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:XS("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await T5t(this.listRuns({id:e.child_run_ids})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:h,traceFilter:m,treeFilter:v,limit:g,select:_}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],M=await Promise.all(E.map(R=>this.readProject({projectName:R}).then(N=>N.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:v,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:_||x,is_root:l},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:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:h,isRoot:m,dataSourceType:v}){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:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:h,is_root:m,data_source_type:v}).filter(([T,E])=>E!==void 0));return await(await this.caller.call(xt(),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(S),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||GO()};Zr(e);let i=await(await this.caller.call(xt(),`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(i===null||!("share_token"in i))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${i.share_token}/r`}async unshareRun(e){Zr(e);let r=await this.caller.call(xt(),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(r,"unshare run",!0)}async readRunSharedLink(e){Zr(e);let n=await(await this.caller.call(xt(),`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let a of r)n.append("id",a);return Zr(e),await(await this.caller.call(xt(),`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),Zr(e);let o=await(await this.caller.call(xt(),`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};Zr(e);let i=await(await this.caller.call(xt(),`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return i.url=`${this.getHostUrl()}/public/${i.share_token}/d`,i}async unshareDataset(e){Zr(e);let r=await this.caller.call(xt(),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(r,"unshare dataset",!0)}async readSharedDataset(e){return Zr(e),await(await this.caller.call(xt(),`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([s,u])=>{Array.isArray(u)?u.forEach(l=>o.append(s,l)):o.append(s,u)});let i=await this.caller.call(xt(),`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
Status: ${i.status}
Message: ${a.detail.join(`
`)}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(xt(),u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(d,"create project"),await d.json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:a=null}){let s=`${this.apiUrl}/sessions/${e}`,u=i;o&&(u={...u||{},metadata:o});let l={name:r,extra:u,description:n,end_time:a?new Date(a).toISOString():null},c=await this.caller.call(xt(),s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(l),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(c,"update project"),await c.json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)Zr(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(xt(),`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});try{let a=await i.json();return i.ok?Array.isArray(a)?a.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)Zr(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let a=await this._get(o,i),s;if(Array.isArray(a)){if(a.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);s=a[0]}else s=a;return s}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,referenceFree:a,metadata:s}={}){let u=new URLSearchParams;if(e!==void 0)for(let l of e)u.append("id",l);if(r!==void 0&&u.append("name",r),n!==void 0&&u.append("name_contains",n),o!==void 0)u.append("reference_dataset",o);else if(i!==void 0){let l=await this.readDataset({datasetName:i});u.append("reference_dataset",l.id)}a!==void 0&&u.append("reference_free",a.toString()),s!==void 0&&u.append("metadata",JSON.stringify(s));for await(let l of this._getPaginated("/sessions",u))yield*l}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,Zr(n);let o=await this.caller.call(xt(),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(o,`delete session ${n} (${r})`,!0)}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:a,name:s}){let u=`${this.apiUrl}/datasets/upload`,l=new FormData;l.append("file",e,r),n.forEach(f=>{l.append("input_keys",f)}),o.forEach(f=>{l.append("output_keys",f)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s);let c=await this.caller.call(xt(),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(c,"upload CSV"),await c.json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:a}={}){let s={name:e,description:r,extra:a?{metadata:a}:void 0};n&&(s.data_type=n),o&&(s.inputs_schema_definition=o),i&&(s.outputs_schema_definition=i);let u=await this.caller.call(xt(),`${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 Ur(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)Zr(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;Zr(i);let a=await this.caller.call(xt(),`${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 Ur(a,"update dataset"),await a.json()}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)Zr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(xt(),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(i,`delete ${n}`),await i.json()}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),Zr(o);let i={tag:n},a=await this.caller.call(xt(),`${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 Ur(a,"index dataset"),await a.json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),Zr(r);let a=await this.caller.call(xt(),`${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 Ur(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,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 d=i||new Date,f={dataset_id:c,inputs:e,outputs:r,created_at:d?.toISOString(),id:a,metadata:s,split:u,source_run_id:l},p=await this.caller.call(xt(),`${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 Ur(p,"create example"),await p.json()}async createExamples(e){let{inputs:r,outputs:n,metadata:o,sourceRunIds:i,exampleIds:a,datasetId:s,datasetName:u}=e,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:e.splits?e.splits[h]:void 0,id:a?a[h]:void 0,source_run_id:i?i[h]:void 0})),d=await this.caller.call(xt(),`${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 Ur(d,"create examples"),await d.json()}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>rse(a)?nse(a):a),i=rse(r)?nse(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Zr(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),h=o?typeof o=="string"?o:o?.toISOString():void 0;h&&p.append("as_of",h);let m=a??!0;if(p.append("inline_s3_urls",m.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let v=0;for await(let g of this._getPaginated("/examples",p)){for(let _ of g){let{attachment_urls:S,...x}=_,O=x;S&&(O.attachments=Object.entries(S).reduce((T,[E,M])=>(T[E.slice(11)]={presigned_url:M.presigned_url},T),{})),yield O,v++}if(u!==void 0&&v>=u)break}}async deleteExample(e){Zr(e);let r=`/examples/${e}`,n=await this.caller.call(xt(),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(n,`delete ${r}`),await n.json()}async updateExample(e,r){Zr(e);let n=await this.caller.call(xt(),`${this.apiUrl}/examples/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(n,"update example"),await n.json()}async updateExamples(e){let r=await this.caller.call(xt(),`${this.apiUrl}/examples/bulk`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(r,"update examples"),await r.json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,Zr(o);let i=new URLSearchParams,a=n?typeof n=="string"?n:n?.toISOString():void 0;return a&&i.append("as_of",a),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let a;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?a=(await this.readDataset({datasetName:r})).id:a=e,Zr(a);let s={split_name:n,examples:o.map(l=>(Zr(l),l)),remove:i},u=await this.caller.call(xt(),`${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 Ur(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){AV("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let h={type:u??"api",metadata:s??{}};l!==void 0&&h?.metadata!==void 0&&!h.metadata.__run&&(h.metadata.__run={run_id:l}),h?.metadata!==void 0&&h.metadata.__run?.run_id!==void 0&&Zr(h.metadata.__run.run_id);let m={id:c??GO(),run_id:e,key:r,score:n,value:o,correction:i,comment:a,feedback_source:h,comparative_experiment_id:p,feedbackConfig:d,session_id:f},v=`${this.apiUrl}/feedback`,g=await this.caller.call(xt(),v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(m),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(g,"create feedback",!0),m}async updateFeedback(e,{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),Zr(e);let s=await this.caller.call(xt(),`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(a),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(s,"update feedback",!0)}async readFeedback(e){Zr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Zr(e);let r=`/feedback/${e}`,n=await this.caller.call(xt(),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(n,`delete ${r}`),await n.json()}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e&&o.append("run",e.join(",")),r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};return n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3},await(await this.caller.call(xt(),`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:a,id:s}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let u={id:s,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};return a&&(u.extra.metadata=a),await(await this.caller.call(xt(),`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async*listPresignedFeedbackTokens(e){Zr(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let a of o){let s=n||{};a.evaluatorInfo&&(s={...a.evaluatorInfo,...s});let u=null;a.targetRunId?u=a.targetRunId:r&&(u=r.id),i.push(await this.createFeedback(u,a.key,{score:a.score,value:a.value,comment:a.comment,correction:a.correction,sourceInfo:s,sourceRunId:a.sourceRunId,feedbackConfig:a.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{Zr(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o}=e,i={name:r,description:n,id:o||GO()},a=await this.caller.call(xt(),`${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 Ur(a,"create annotation queue"),await a.json()}async readAnnotationQueue(e){let r=await this.listAnnotationQueues({queueIds:[e]}).next();if(r.done)throw new Error(`Annotation queue with ID ${e} not found`);return r.value}async updateAnnotationQueue(e,r){let{name:n,description:o}=r,i=await this.caller.call(xt(),`${this.apiUrl}/annotation-queues/${Zr(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(xt(),`${this.apiUrl}/annotation-queues/${Zr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(xt(),`${this.apiUrl}/annotation-queues/${Zr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Zr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Ur(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Zr(e,"queueId")}/run`,o=await this.caller.call(xt(),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ur(o,"get run from annotation queue"),await o.json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.
Current tenant: ${n.tenant_handle}
Requested tenant: ${r}`)}async _getLatestCommitHash(e){let r=await this.caller.call(xt(),`${this.apiUrl}/commits/${e}/?limit=${1}&offset=${0}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),n=await r.json();if(!r.ok){let o=typeof n.detail=="string"?n.detail:JSON.stringify(n.detail),i=new Error(`Error ${r.status}: ${r.statusText}
${o}`);throw i.statusCode=r.status,i}if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=YS(e),a=await this.caller.call(xt(),`${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 Ur(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=YS(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=YS(e),i=await this.caller.call(xt(),`${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 Ur(i,"get prompt");let a=await i.json();return a.repo?a.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first
creating a LangChain Hub handle.
You can add a handle by creating a public prompt at:
https://smith.langchain.com/prompts`);let[o,i,a]=YS(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let s={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},u=await this.caller.call(xt(),`${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 Ur(u,"create prompt");let{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,a]=YS(e),s=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,u={manifest:JSON.parse(JSON.stringify(r)),parent_commit:s},l=await this.caller.call(xt(),`${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 Ur(l,"create commit");let c=await l.json();return this._getPromptUrl(`${o}/${i}${c.commit_hash?`:${c.commit_hash}`:""}`)}async updateExamplesMultipart(e,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=uf(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=uf(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=uf(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=uf(a.attachments_operations),f=new Blob([d],{type:"application/json"});n.append(`${s}.attachments_operations`,f)}}return await(await this.caller.call(xt(),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,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??GO()).toString(),u={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split}},l=uf(u),c=new Blob([l],{type:"application/json"});n.append(s,c);let d=uf(a.inputs),f=new Blob([d],{type:"application/json"});if(n.append(`${s}.inputs`,f),a.outputs){let p=uf(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,v;Array.isArray(h)?[m,v]=h:(m=h.mimeType,v=h.data);let g=new Blob([v],{type:`${m}; length=${v.byteLength}`});n.append(`${s}.attachment.${p}`,g)}}return await(await this.caller.call(xt(),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n})).json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=YS(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let a=await this.caller.call(xt(),`${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 Ur(a,"update prompt"),a.json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=YS(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(xt(),`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async pullPromptCommit(e,r){let[n,o,i]=YS(e),a=await this.caller.call(xt(),`${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 Ur(a,"pull prompt commit");let s=await a.json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(e,n),s=new Sy({apiUrl:i,apiKey:"placeholder"}),u=await s.readSharedDataset(a),l=o||u.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let c=await s.listSharedExamples(a),d=await this.createDataset(l,{description:u.description,dataType:u.data_type||"kv",inputsSchema:u.inputs_schema_definition??void 0,outputsSchema:u.outputs_schema_definition??void 0});try{await this.createExamples({inputs:c.map(f=>f.inputs),outputs:c.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return Zr(e),[r,e]}catch{}try{let a=new URL(e).pathname.split("/").filter(s=>s!=="");if(a.length>=n){let s=a[a.length-n];return[r,s]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}awaitPendingTraceBatches(){return this.manualFlushMode?(console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve()):Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()])}}});var UV,zV=C(()=>{Ose();WV();TV();UV="0.2.14"});function HV(){if(Ese===void 0){let t=L5t(),e=k5t();Ese={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:UV,...e}}return Ese}function yNe(){let t=F5t()||{},e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))(n.startsWith("LANGCHAIN_")||n.startsWith("LANGSMITH_"))&&typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function F5t(){try{return typeof process<"u"&&process.env?Object.entries(process.env).reduce((t,[e,r])=>(t[e]=String(r),t),{}):void 0}catch{return}}function xy(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function XS(t){return xy(`LANGSMITH_${t}`)||xy(`LANGCHAIN_${t}`)}function k5t(){if(Pse!==void 0)return Pse;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=xy(r);n!==void 0&&(e[r]=n)}return Pse=e,e}var ZS,I5t,D5t,j5t,bNe,N5t,L5t,Ese,Pse,VV=C(()=>{zV();I5t=()=>typeof window<"u"&&typeof window.document<"u",D5t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",j5t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),bNe=()=>typeof Deno<"u",N5t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!bNe(),L5t=()=>ZS||(I5t()?ZS="browser":N5t()?ZS="node":D5t()?ZS="webworker":j5t()?ZS="jsdom":bNe()?ZS="deno":ZS="other",ZS)});var _Ne,vNe=C(()=>{VV();_Ne=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>XS(r)==="true")});var JV,wNe=C(()=>{JV=Symbol.for("lc:context_variables")});function B5t(t){return t.replace(/[-:.]/g,"")}function $5t(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return B5t(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function GV(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function xNe(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function SNe(t){return Array.isArray(t)&&t.some(e=>xNe(e))}function q5t(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function U5t(t){return t!==void 0&&typeof t.callbacks=="object"&&(SNe(t.callbacks?.handlers)||SNe(t.callbacks))}var wj,Wu,WV=C(()=>{SV();VV();Ose();vNe();ose();wNe();wj=class{constructor(e,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=e,this.tags=r}static fromHeader(e){let r=e.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 wj(n,o)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),e.join(",")}},Wu=class{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),GV(e)){Object.assign(this,{...e});return}let r=Wu.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??Wu.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=$5t(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:GO(),run_type:"chain",project_name:xy("LANGCHAIN_PROJECT")??xy("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:xy("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:xy("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return Wu.sharedClient||(Wu.sharedClient=new Sy),Wu.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new Wu({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});JV in this&&(n[JV]=this[JV]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(U5t(i)){let u={...i},l=q5t(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(xNe)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o.runtime||(o.runtime={}),r)for(let[u,l]of Object.entries(r))o.runtime[u]||(o.runtime[u]=l);let i,a;return n?(a=e.parent_run?.id,i=[]):(i=e.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments}}async postRun(e=!0){try{let r=HV(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){AV("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=_Ne();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 Wu({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:a,tracingEnabled:s,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new Wu({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),a=i.split(".").map(l=>{let[c,d]=l.split("Z");return{strTime:c,time:Date.parse(c+"Z"),uuid:d}}),s=a[0].uuid,u={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:s,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=wj.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags}return new Wu(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new wj(this.extra?.metadata,this.tags).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Wu,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function KV(t){return typeof t=="function"&&"langsmith:traceable"in t}var Mse,Tse,z5t,Ase,H5t,CNe,Hyn,ONe=C(()=>{WV();Mse=class{getStore(){}run(e,r){return r()}},Tse=Symbol.for("ls:tracing_async_local_storage"),z5t=new Mse,Ase=class{getInstance(){return globalThis[Tse]??z5t}initializeGlobalInstance(e){globalThis[Tse]===void 0&&(globalThis[Tse]=e)}},H5t=new Ase,CNe=()=>{let t=H5t.getInstance().getStore();if(!GV(t))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 t},Hyn=Symbol.for("langsmith:traceable:root")});var Rse=C(()=>{ONe()});function XV(t,e){return V5t.call(t,e)}function ZV(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n<r.length;n++)r[n]=""+n;return r}if(Object.keys)return Object.keys(t);let e=[];for(let r in t)XV(t,r)&&e.push(r);return e}function Uc(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function QV(t){let e=0,r=t.length,n;for(;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Cy(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Mq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function YV(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(YV(t[r]))return!0}else if(typeof t=="object"){let r=ZV(t),n=r.length;for(var e=0;e<n;e++)if(YV(t[r[e]]))return!0}}return!1}function ENe(t,e){let r=[t];for(let n in e){let o=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof o<"u"&&r.push(`${n}: ${o}`)}return r.join(`
`)}var V5t,pA,Aq=C(()=>{V5t=Object.prototype.hasOwnProperty;pA=class extends Error{constructor(e,r,n,o,i){super(ENe(e,{name:r,index:n,operation:o,tree:i})),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"tree",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.setPrototypeOf(this,new.target.prototype),this.message=ENe(e,{name:r,index:n,operation:o,tree:i})}}});var Ise={};nf(Ise,{JsonPatchError:()=>Na,_areEquals:()=>Rq,applyOperation:()=>hA,applyPatch:()=>KO,applyReducer:()=>G5t,deepClone:()=>W5t,getValueByPointer:()=>e5,validate:()=>PNe,validator:()=>t5});function e5(t,e){if(e=="")return t;var r={op:"_get",path:e};return hA(t,r),r.value}function hA(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):t5(e,0)),e.path===""){let a={newDocument:t};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=t,a;if(e.op==="move"||e.op==="copy")return a.newDocument=e5(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=Rq(t,e.value),a.test===!1)throw new Na("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a.newDocument=t,a}else{if(e.op==="remove")return a.removed=t,a.newDocument=null,a;if(e.op==="_get")return e.value=t,a;if(r)throw new Na("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Uc(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=t5;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=Mq(f)),o&&(f=="__proto__"||f=="prototype"&&l>0&&s[l-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(u[f]===void 0?d=s.slice(0,l).join("/"):l==c-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),l++,Array.isArray(u)){if(f==="-")f=u.length;else{if(r&&!QV(f))throw new Na("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);QV(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Na("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let h=J5t[e.op].call(e,u,f,t);if(h.test===!1)throw new Na("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}}else if(l>=c){let h=Sj[e.op].call(e,u,f,t);if(h.test===!1)throw new Na("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Na("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function KO(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Na("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Uc(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=hA(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function G5t(t,e,r){let n=hA(t,e);if(n.test===!1)throw new Na("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function t5(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Na("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Sj[t.op]){if(typeof t.path!="string")throw new Na("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Na('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new Na("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new Na("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&YV(t.value))throw new Na("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new Na("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new Na("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var a={op:"_get",path:t.from,value:void 0},s=PNe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Na("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Na("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function PNe(t,e,r){try{if(!Array.isArray(t))throw new Na("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)KO(Uc(e),Uc(t),r||!0);else{r=r||t5;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Na)return o;throw o}}function Rq(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),o,i,a;if(r&&n){if(i=t.length,i!=e.length)return!1;for(o=i;o--!==0;)if(!Rq(t[o],e[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(t);if(i=s.length,i!==Object.keys(e).length)return!1;for(o=i;o--!==0;)if(!e.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!Rq(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Na,W5t,Sj,J5t,r5=C(()=>{Aq();Na=pA,W5t=Uc,Sj={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=e5(r,this.path);n&&(n=Uc(n));let o=hA(r,{op:"remove",path:this.from}).removed;return hA(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=e5(r,this.from);return hA(r,{op:"add",path:this.path,value:Uc(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Rq(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},J5t={add:function(t,e,r){return QV(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:Sj.move,copy:Sj.copy,test:Sj.test,_get:Sj._get}});function TNe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=ZV(e),a=ZV(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(XV(e,c)&&!(e[c]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[c];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?TNe(d,f,r,n+"/"+Cy(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+Cy(c),value:Uc(d)}),r.push({op:"replace",path:n+"/"+Cy(c),value:Uc(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Cy(c),value:Uc(d)}),r.push({op:"remove",path:n+"/"+Cy(c)}),u=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),s=!0)}if(!(!u&&i.length==a.length))for(var l=0;l<i.length;l++){var c=i[l];!XV(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+Cy(c),value:Uc(e[c])})}}}function n5(t,e,r=!1){var n=[];return TNe(t,e,n,"",r),n}var MNe=C(()=>{Aq();r5();});var ebn,Dse=C(()=>{r5();MNe();Aq();r5();Aq();ebn={...Ise,JsonPatchError:pA,deepClone:Uc,escapePathComponent:Cy,unescapePathComponent:Mq}});var RNe=b((ibn,ANe)=>{"use strict";ANe.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var kNe=b((abn,jse)=>{"use strict";var K5t=/[\p{Lu}]/u,Y5t=/[\p{Ll}]/u,INe=/^[\p{Lu}](?![\p{Lu}])/gu,NNe=/([\p{Alpha}\p{N}_]|$)/u,LNe=/[_.\- ]+/,X5t=new RegExp("^"+LNe.source),DNe=new RegExp(LNe.source+NNe.source,"gu"),jNe=new RegExp("\\d+"+NNe.source,"gu"),Z5t=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&K5t.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&Y5t.test(s)?(t=t.slice(0,a-1)+"-"+t.slice(a-1),i=o,o=!1,n=!0):(n=e(s)===s&&r(s)!==s,i=o,o=r(s)===s&&e(s)!==s)}return t},Q5t=(t,e)=>(INe.lastIndex=0,t.replace(INe,r=>e(r))),e9t=(t,e)=>(DNe.lastIndex=0,jNe.lastIndex=0,t.replace(DNe,(r,n)=>e(n)).replace(jNe,r=>e(r))),FNe=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=Z5t(t,r,n)),t=t.replace(X5t,""),e.preserveConsecutiveUppercase?t=Q5t(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),e9t(t,n))};jse.exports=FNe;jse.exports.default=FNe});function $Ne(t,e){return e?.[t]||(0,BNe.default)(t)}function qNe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var BNe,t9t,UNe=C(()=>{BNe=B(RNe(),1),t9t=B(kNe(),1)});function zNe(t){return Array.isArray(t)?[...t]:{...t}}function r9t(t,e){let r=zNe(t);for(let[n,o]of Object.entries(e)){let[i,...a]=n.split(".").reverse(),s=r;for(let u of a.reverse()){if(s[u]===void 0)break;s[u]=zNe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Nse(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var zc,mA=C(()=>{UNe();zc=class{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(e,...r){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof zc||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,a=n,[s,...u]=o.split(".").reverse();for(let l of u.reverse()){if(!(l in i)||i[l]===void 0)return;(!(l in a)||a[l]===void 0)&&(typeof i[l]=="object"&&i[l]!=null?a[l]={}:Array.isArray(i[l])&&(a[l]=[])),i=i[l],a=a[l]}s in i&&i[s]!==void 0&&(a[s]=a[s]||i[s])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:qNe(Object.keys(r).length?r9t(n,r):n,$Ne,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function HNe(){return Lse===void 0&&(Lse={library:"langchain-js",runtime:s9t()}),Lse}function Yt(t){try{return typeof process<"u"?process.env?.[t]:Fse()?Deno?.env.get(t):void 0}catch{return}}var n9t,o9t,i9t,Fse,a9t,s9t,Lse,gA=C(()=>{n9t=()=>typeof window<"u"&&typeof window.document<"u",o9t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",i9t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Fse=()=>typeof Deno<"u",a9t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Fse(),s9t=()=>{let t;return n9t()?t="browser":a9t()?t="node":o9t()?t="webworker":i9t()?t="jsdom":Fse()?t="deno":t="other",t}});function Bse(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var kse,QS,VNe,Iq=C(()=>{_q();mA();gA();kse=class{};QS=class 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(e){super(),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreLLM",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreChain",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreAgent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreRetriever",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreCustomEvent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"raiseError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"awaitHandlers",{enumerable:!0,configurable:!0,writable:!0,value:Yt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return zc.prototype.toJSON.call(this)}toJSONNotImplemented(){return zc.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends QS{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:af()}),Object.assign(this,e)}}return new r}},VNe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function $se(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function u9t(t){return t.replace(/[-:.]/g,"")}function l9t(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return u9t(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function xj(t){return typeof t._addRunToRunMap=="function"}var uh,yA=C(()=>{Iq();uh=class extends QS{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`
${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let r=l9t(e.start_time,e.id,e.execution_order),n={...e};if(n.parent_run_id!==void 0){let o=this.runMap.get(n.parent_run_id);o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,r].join(".")))}else n.trace_id=n.id,n.dotted_order=r;return this.runMap.set(n.id,n),n}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.runMap.get(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),this.runMap.delete(e.id),await this.onRunUpdate?.(e)}_getExecutionOrder(e){let r=e!==void 0&&this.runMap.get(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=$se(e,"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(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=$se(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.runMap.get(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var KNe=b((gbn,GNe)=>{"use strict";var WNe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,JNe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function c9t(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=WNe(),e.color.ansi16m=JNe(),e.bgColor.ansi256=WNe(10),e.bgColor.ansi16m=JNe(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(a=>a+a).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty(GNe,"exports",{enumerable:!0,get:c9t})});function Rd(t,e){return`${t.open}${e}${t.close}`}function lh(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function YNe(t){return typeof t=="string"?t.trim():t==null?t:lh(t,t.toString())}function YO(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var qse,lf,Dq,XNe=C(()=>{qse=B(KNe(),1);yA();({color:lf}=qse.default),Dq=class extends uh{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"console_callback_handler"})}persistRun(e){return Promise.resolve()}getParents(e){let r=[],n=e;for(;n.parent_run_id;){let o=this.runMap.get(n.parent_run_id);if(o)r.push(o),n=o;else break}return r}getBreadcrumbs(e){let n=[...this.getParents(e).reverse(),e].map((o,i,a)=>{let s=`${o.execution_order}:${o.run_type}:${o.name}`;return i===a.length-1?Rd(qse.default.bold,s):s}).join(" > ");return Rd(lf.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.green,"[chain/start]")} [${r}] Entering Chain run with input: ${lh(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.cyan,"[chain/end]")} [${r}] [${YO(e)}] Exiting Chain run with output: ${lh(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.red,"[chain/error]")} [${r}] [${YO(e)}] Chain run errored with error: ${lh(e.error,"[error]")}`)}onLLMStart(e){let r=this.getBreadcrumbs(e),n="prompts"in e.inputs?{prompts:e.inputs.prompts.map(o=>o.trim())}:e.inputs;console.log(`${Rd(lf.green,"[llm/start]")} [${r}] Entering LLM run with input: ${lh(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.cyan,"[llm/end]")} [${r}] [${YO(e)}] Exiting LLM run with output: ${lh(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.red,"[llm/error]")} [${r}] [${YO(e)}] LLM run errored with error: ${lh(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.green,"[tool/start]")} [${r}] Entering Tool run with input: "${YNe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.cyan,"[tool/end]")} [${r}] [${YO(e)}] Exiting Tool run with output: "${YNe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.red,"[tool/error]")} [${r}] [${YO(e)}] Tool run errored with error: ${lh(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${lh(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.cyan,"[retriever/end]")} [${r}] [${YO(e)}] Exiting Retriever run with output: ${lh(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Rd(lf.red,"[retriever/error]")} [${r}] [${YO(e)}] Retriever run errored with error: ${lh(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Rd(lf.blue,"[agent/action]")} [${n}] Agent selected action: ${lh(r.actions[r.actions.length-1],"[action]")}`)}}});function XO(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var jq=C(()=>{});function Oj(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}var Cj,o5=C(()=>{Cj=class extends Error{constructor(e,r){super(e),Object.defineProperty(this,"output",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.output=r}}});function Use(t,e=Ej){t=t.trim();let r=/```(json)?(.*)```/s.exec(t);return e(r?r[2]:t)}function Ej(t){if(typeof t>"u")return null;try{return JSON.parse(t)}catch{}let e="",r=[],n=!1,o=!1;for(let i of t){if(n)i==='"'&&!o?n=!1:i===`
`&&!o?i="\\n":i==="\\"?o=!o:o=!1;else if(i==='"')n=!0,o=!1;else if(i==="{")r.push("}");else if(i==="[")r.push("]");else if(i==="}"||i==="]")if(r&&r[r.length-1]===i)r.pop();else return null;e+=i}n&&(e+='"');for(let i=r.length-1;i>=0;i-=1)e+=r[i];try{return JSON.parse(e)}catch{return null}}var zse=C(()=>{});function ch(t,e){return typeof t=="string"?typeof e=="string"?t+e:[{type:"text",text:t},...e]:Array.isArray(e)?Nq(t,e)??[...t,...e]:[...t,{type:"text",text:e}]}function ZNe(t,e){return t==="error"||e==="error"?"error":"success"}function d9t(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(a=>r(a,o+1));let i={};for(let a of Object.keys(n))i[a]=r(n[a],o+1);return i}return JSON.stringify(r(t,0),null,2)}function Za(t,e){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=Za(r[n],o);else if(Array.isArray(r[n]))r[n]=Nq(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 Nq(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>i.index===n.index);o!==-1?r[o]=Za(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function QNe(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
Left ${typeof t}
Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return Nq(t,e);if(typeof t=="object"&&typeof e=="object")return Za(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function eLe(t){return typeof t.role=="string"}function dh(t){return typeof t?._getType=="function"}function Hse(t){return dh(t)&&typeof t.concat=="function"}var Ju,cf,fh=C(()=>{mA();Ju=class extends zc{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(e,r){typeof e=="string"&&(e={content:e,additional_kwargs:r,response_metadata:{}}),e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.content=e.content,this.additional_kwargs=e.additional_kwargs,this.response_metadata=e.response_metadata,this.id=e.id}toDict(){return{type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=d9t(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};cf=class extends Ju{}});function tLe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function rLe(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments),a={name:o||"",args:i||{},id:n.id};e.push(a)}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}var ex,Oy,Pj=C(()=>{fh();ex=class extends Ju{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(e,r,n){typeof e=="string"&&(e={content:e,name:n,tool_call_id:r}),super(e),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}_getType(){return"tool"}static isInstance(e){return e._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Oy=class extends cf{constructor(e){super(e),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}_getType(){return"tool"}concat(e){return new Oy({content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),artifact:QNe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:ZNe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Gu(t){return t._getType()==="ai"}function Vse(t){return t._getType()==="ai"}var To,Dr,bA=C(()=>{zse();fh();Pj();To=class extends Ju{get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(e,r){let n;if(typeof e=="string")n={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:r??{}};else{n=e;let o=n.additional_kwargs?.tool_calls,i=n.tool_calls;o!=null&&o.length>0&&(i===void 0||i.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling.
Please upgrade your packages to versions that set`,"message tool calls. e.g., `yarn add @langchain/anthropic`,","yarn add @langchain/openai`, etc."].join(" "));try{if(o!=null&&i===void 0){let[a,s]=rLe(o);n.tool_calls=a??[],n.invalid_tool_calls=s??[]}else n.tool_calls=n.tool_calls??[],n.invalid_tool_calls=n.invalid_tool_calls??[]}catch{n.tool_calls=[],n.invalid_tool_calls=[]}}super(n),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof n!="string"&&(this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=n.usage_metadata}static lc_name(){return"AIMessage"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}};Dr=class extends cf{constructor(e){let r;if(typeof e=="string")r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0)r={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let n=[],o=[];for(let i of e.tool_call_chunks){let a={};try{if(a=Ej(i.args||"{}"),a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");n.push({name:i.name??"",args:a,id:i.id,type:"tool_call"})}catch{o.push({name:i.name,args:i.args,id:i.id,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:n,invalid_tool_calls:o,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tool_call_chunks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_chunks=r.tool_call_chunks??this.tool_call_chunks,this.tool_calls=r.tool_calls??this.tool_calls,this.invalid_tool_calls=r.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=r.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let r={content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),tool_call_chunks:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let n=Nq(this.tool_call_chunks,e.tool_call_chunks);n!==void 0&&n.length>0&&(r.tool_call_chunks=n)}if(this.usage_metadata!==void 0||e.usage_metadata!==void 0){let n={...(this.usage_metadata?.input_token_details?.audio!==void 0||e.usage_metadata?.input_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.input_token_details?.audio??0)+(e.usage_metadata?.input_token_details?.audio??0)},...(this.usage_metadata?.input_token_details?.cache_read!==void 0||e.usage_metadata?.input_token_details?.cache_read!==void 0)&&{cache_read:(this.usage_metadata?.input_token_details?.cache_read??0)+(e.usage_metadata?.input_token_details?.cache_read??0)},...(this.usage_metadata?.input_token_details?.cache_creation!==void 0||e.usage_metadata?.input_token_details?.cache_creation!==void 0)&&{cache_creation:(this.usage_metadata?.input_token_details?.cache_creation??0)+(e.usage_metadata?.input_token_details?.cache_creation??0)}},o={...(this.usage_metadata?.output_token_details?.audio!==void 0||e.usage_metadata?.output_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.output_token_details?.audio??0)+(e.usage_metadata?.output_token_details?.audio??0)},...(this.usage_metadata?.output_token_details?.reasoning!==void 0||e.usage_metadata?.output_token_details?.reasoning!==void 0)&&{reasoning:(this.usage_metadata?.output_token_details?.reasoning??0)+(e.usage_metadata?.output_token_details?.reasoning??0)}},i=this.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},a=e.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},s={input_tokens:i.input_tokens+a.input_tokens,output_tokens:i.output_tokens+a.output_tokens,total_tokens:i.total_tokens+a.total_tokens,...Object.keys(n).length>0&&{input_token_details:n},...Object.keys(o).length>0&&{output_token_details:o}};r.usage_metadata=s}return new Dr(r)}}});var Gl,ap,i5=C(()=>{fh();Gl=class extends Ju{static lc_name(){return"ChatMessage"}static _chatMessageClass(){return Gl}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}static isInstance(e){return e._getType()==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},ap=class extends cf{static lc_name(){return"ChatMessageChunk"}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}concat(e){return new ap({content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var Hm,a5=C(()=>{fh();Hm=class extends cf{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new Hm({content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Qa,sp,Lq=C(()=>{fh();Qa=class extends Ju{static lc_name(){return"HumanMessage"}_getType(){return"human"}},sp=class extends cf{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}concat(e){return new sp({content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var tx,ph,s5=C(()=>{fh();tx=class extends Ju{static lc_name(){return"SystemMessage"}_getType(){return"system"}},ph=class extends cf{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}concat(e){return new ph({content:ch(this.content,e.content),additional_kwargs:Za(this.additional_kwargs,e.additional_kwargs),response_metadata:Za(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function p9t(t){return Oj(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function h9t(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Wse(t){let e,r;if(h9t(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new Qa(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new To(r);let i=n.map(p9t);return new To({...o,tool_calls:i})}else{if(e==="system")return new tx(r);if(e==="developer")return new tx({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new ex({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw XO(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function Vm(t){if(typeof t=="string")return new Qa(t);if(dh(t))return t;if(Array.isArray(t)){let[e,r]=t;return Wse({type:e,content:r})}else if(eLe(t)){let{role:e,...r}=t;return Wse({...r,type:e})}else return Wse(t)}function df(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="function")i="Function";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let a=o.name?`${o.name}, `:"",s=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${a}${s}`)}return n.join(`
`)}function Jse(t){let e=t._getType();if(e==="human")return new sp({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new Dr({...r})}else{if(e==="system")return new ph({...t});if(e==="function")return new Hm({...t});if(Gl.isInstance(t))return new ap({...t});throw new Error("Unknown message type.")}}var ZO=C(()=>{jq();o5();bA();fh();i5();a5();Lq();s5();Pj()});var Gse=C(()=>{WV()});var Kse=C(()=>{zV()});var Yse,nLe,oLe=C(()=>{Kse();gA();nLe=()=>{if(Yse===void 0){let t=Yt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};Yse=new Sy(t)}return Yse}});var QO,iLe=C(()=>{Gse();Rse();gA();yA();oLe();QO=class extends uh{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{exampleId:r,projectName:n,client:o}=e;this.projectName=n??Yt("LANGCHAIN_PROJECT")??Yt("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??nLe();let i=QO.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await HNe()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new Wu({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});r[o]=a,n.push([o,i.dotted_order])}n.sort((o,i)=>!o[1]||!i[1]?0:o[1].localeCompare(i[1]));for(let[o]of n){let i=this.runMap.get(o),a=r[o];if(!(!i||!a)&&i.parent_run_id){let s=r[i.parent_run_id];s&&(s.child_runs.push(a),a.parent_run=s)}}return r[e]}static getTraceableRunTree(){try{return CNe()}catch{return}}}});var aLe,_A,sLe,eE,Fq=C(()=>{aLe=Symbol.for("ls:tracing_async_local_storage"),_A=Symbol.for("lc:context_variables"),sLe=t=>{globalThis[aLe]=t},eE=()=>globalThis[aLe]});function m9t(){let t="default"in u5.default?u5.default.default:u5.default;return new t({autoStart:!0,concurrency:1})}function g9t(){return typeof kq>"u"&&(kq=m9t()),kq}async function es(t,e){if(e===!0){let r=eE();r!==void 0?await r.run(void 0,async()=>t()):await t()}else kq=g9t(),kq.add(async()=>{let r=eE();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var u5,kq,uLe=C(()=>{u5=B(PV(),1);Fq()});var lLe=C(()=>{uLe()});var cLe,dLe=C(()=>{gA();cLe=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>Yt(r)==="true")});function Xse(t){let e=eE();return e===void 0?void 0:e.getStore()?.[_A]?.[t]}var y9t,fLe,pLe=C(()=>{Gse();Fq();y9t=Symbol("lc:configure_hooks"),fLe=()=>Xse(y9t)||[]});function vA(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function Bq(t){return"name"in t?t:QS.fromMethods(t)}var Zse,Tj,Qse,l5,eue,tue,_i,tE=C(()=>{_q();Iq();XNe();ZO();gA();iLe();lLe();dLe();yA();pLe();Zse=class{setHandler(e){return this.setHandlers([e])}},Tj=class{constructor(e,r,n,o,i,a,s,u){Object.defineProperty(this,"runId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:u})}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(r=>es(async()=>{try{await r.handleText?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleText: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{try{await a.handleCustomEvent?.(e,r,this.runId,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},Qse=class extends Tj{getChild(e){let r=new _i(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetriever`),r.raiseError)throw n}},r.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetrieverError: ${n}`),r.raiseError)throw e}},r.awaitHandlers)))}},l5=class extends Tj{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>es(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(e,r??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a)}catch(u){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${u}`),s.raiseError)throw u}},s.awaitHandlers)))}async handleLLMError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{if(!a.ignoreLLM)try{await a.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleLLMEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{if(!a.ignoreLLM)try{await a.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},eue=class extends Tj{getChild(e){let r=new _i(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleChainError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{if(!a.ignoreChain)try{await a.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleChainEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{if(!a.ignoreChain)try{await a.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreAgent)try{await r.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentAction: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreAgent)try{await r.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},tue=class extends Tj{getChild(e){let r=new _i(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleToolError(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreAgent)try{await r.handleToolError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolError: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(r=>es(async()=>{if(!r.ignoreAgent)try{await r.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},_i=class extends Zse{constructor(e,r){super(),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"callback_manager"}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:af();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return xj(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),es(async()=>{try{await f.handleLLMStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new l5(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:af();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return xj(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),es(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u);else if(f.handleLLMStart){let p=df(l);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,u)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new l5(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=af(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return xj(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),es(async()=>{try{await u.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleChainStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new eue(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=af(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return xj(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),es(async()=>{try{await u.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleToolStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new tue(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=af(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return xj(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),es(async()=>{try{await u.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleRetrieverStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new Qse(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>es(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new _i(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends QS{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:af()}),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,a,s){return this._configureSync(e,r,n,o,i,a,s)}static _configureSync(e,r,n,o,i,a,s){let u;(e||r)&&(Array.isArray(e)||!e?(u=new _i,u.setHandlers(e?.map(Bq)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(Bq):r?.handlers,!1));let l=Yt("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=QO.getTraceableRunTree()?.tracingEnabled||cLe(),d=c||(Yt("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new _i),l&&!u.handlers.some(f=>f.name===Dq.prototype.name)){let f=new Dq;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new QO;u.addHandler(f,!0),u._parentRunId=QO.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:h,envVar:m}of fLe()){let v=m&&Yt(m)==="true"&&h,g,_=f!==void 0?Xse(f):void 0;_&&VNe(_)?g=_:v&&(g=new h({})),g!==void 0&&(u||(u=new _i),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 c5,b9t,hLe,rue,Hc,mLe=C(()=>{Kse();Fq();tE();c5=class{getStore(){}run(e,r){return r()}enterWith(e){}},b9t=new c5,hLe=Symbol.for("lc:child_config"),rue=class{getInstance(){return eE()??b9t}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[hLe]}runWithConfig(e,r,n){let o=_i._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),s=o?.getParentRunId(),u=o?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return u&&s?l=u.convertToRunTree(s):n||(l=new Wu({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[hLe]:e}),a!==void 0&&a[_A]!==void 0&&(l[_A]=a[_A]),i.run(l,r)}initializeGlobalInstance(e){eE()===void 0&&sLe(e)}},Hc=new rue});var Mj=C(()=>{mLe();Fq()});async function ff(t){return _i._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function f5(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let a=o.copy();for(let s of i)a.addHandler(Bq(s),!0);e.callbacks=a}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let a=i.copy();for(let s of o)a.addHandler(Bq(s),!0);e.callbacks=a}else e.callbacks=new _i(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}function jr(t){let e=Hc.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((a,[s,u])=>(u!==void 0&&(a[s]=u),a),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))_9t.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 La(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=jr(t);return e!==void 0&&(delete s.runName,s.callbacks=e),n!==void 0&&(s.recursionLimit=n),r!==void 0&&(s.maxConcurrency=r),o!==void 0&&(s.runName=o),i!==void 0&&(s.configurable={...s.configurable,...i}),a!==void 0&&delete s.runId,s}function up(t){return t?{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal}:void 0}var d5,_9t,Ey=C(()=>{tE();Mj();d5=25;_9t=new Set(["string","number","boolean"])});async function Py(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(new Error("Aborted"))},e.addEventListener("abort",r),e.aborted&&o(new Error("Aborted"))})]).finally(()=>e.removeEventListener("abort",r))}var nue=C(()=>{});function oue(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function yl(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=yl(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function gLe(t,e,r,n,...o){let i=new rx({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Ku,rx,Ty=C(()=>{Ey();Mj();nue();Ku=class extends ReadableStream{constructor(){super(...arguments),Object.defineProperty(this,"reader",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new Ku({start(n){return o();function o(){return r.read().then(({done:i,value:a})=>{if(i){n.close();return}return n.enqueue(a),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new Ku({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};rx=class{constructor(e){Object.defineProperty(this,"generator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResultUsed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((r,n)=>{Hc.runWithConfig(up(e.config),async()=>{this.firstResult=e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(r,n):this.firstResult.then(o=>r(void 0),n)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?Hc.runWithConfig(up(this.config),this.signal?async()=>Py(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});async function yLe(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function bLe(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function v9t(t){return t!==void 0&&t.message!==void 0}var Wm,rE,_Le,$q,vLe=C(()=>{Dse();yA();Ty();bA();Wm=class{constructor(e){Object.defineProperty(this,"ops",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ops=e.ops??[]}concat(e){let r=this.ops.concat(e.ops),n=KO({},r);return new rE({ops:r,state:n[n.length-1].newDocument})}},rE=class extends Wm{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=KO(this.state,e.ops);return new rE({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=KO({},e.ops);return new rE({ops:e.ops,state:r[r.length-1].newDocument})}},_Le=t=>t.name==="log_stream_tracer";$q=class extends uh{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_schemaFormat",{enumerable:!0,configurable:!0,writable:!0,value:"original"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyMapByRunId",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"counterMapByRunName",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"log_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Ku.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){for await(let n of r){if(e!==this.rootId){let o=this.keyMapByRunId[e];o&&await this.writer.write(new Wm({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new Wm({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;this.counterMapByRunName[e.name]===void 0&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;let r=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=r===1?e.name:`${e.name}:${r}`;let n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(n.inputs=await yLe(e,this._schemaFormat)),await this.writer.write(new Wm({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{let r=this.keyMapByRunId[e.id];if(r===void 0)return;let n=[];this._schemaFormat==="streaming_events"&&n.push({op:"replace",path:`/logs/${r}/inputs`,value:await yLe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await bLe(e,this._schemaFormat)}),e.end_time!==void 0&&n.push({op:"add",path:`/logs/${r}/end_time`,value:new Date(e.end_time).toISOString()});let o=new Wm({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Wm({ops:[{op:"replace",path:"/final_output",value:await bLe(e,this._schemaFormat)}]});await this.writer.write(r),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,r,n){let o=this.keyMapByRunId[e.id];if(o===void 0)return;let i=e.inputs.messages!==void 0,a;i?v9t(n?.chunk)?a=n?.chunk:a=new Dr({id:`run-${e.id}`,content:r}):a=r;let s=new Wm({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 qq,pf,Ho,Aj=C(()=>{qq="__run",pf=class{constructor(e){Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generationInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new pf({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Ho=class extends pf{constructor(e){super(e),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.message=e.message}concat(e){return new Ho({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}}});function p5({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var wLe,h5,SLe=C(()=>{yA();Ty();bA();Aj();wLe=t=>t.name==="event_stream_tracer",h5=class extends uh{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"runInfoMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tappedPromises",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"event_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Ku.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.runType)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.runType)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){let n=await r.next();if(n.done)return;let o=this.runInfoMap.get(e);if(o===void 0){yield n.value;return}function i(s,u){return s==="llm"&&typeof u=="string"?new pf({text:u}):u}let a=this.tappedPromises.get(e);if(a===void 0){let s;a=new Promise(u=>{s=u}),this.tappedPromises.set(e,a);try{let u={event:`on_${o.runType}_stream`,run_id:e,name:o.name,tags:o.tags,metadata:o.metadata,data:{}};await this.send({...u,data:{chunk:i(o.runType,n.value)}},o),yield n.value;for await(let l of r)o.runType!=="tool"&&o.runType!=="retriever"&&await this.send({...u,data:{chunk:i(o.runType,l)}},o),yield l}finally{s()}}else{yield n.value;for await(let s of r)yield s}}async send(e,r){this._includeRun(r)&&await this.writer.write(e)}async sendEndEvent(e,r){let n=this.tappedPromises.get(e.run_id);n!==void 0?n.then(()=>{this.send(e,r)}):await this.send(e,r)}async onLLMStart(e){let r=p5(e),n=e.inputs.messages!==void 0?"chat_model":"llm",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,o);let i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onLLMNewToken(e,r,n){let o=this.runInfoMap.get(e.id),i,a;if(o===void 0)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(this.runInfoMap.size!==1){if(o.runType==="chat_model")a="on_chat_model_stream",n?.chunk===void 0?i=new Dr({content:r,id:`run-${e.id}`}):i=n.chunk.message;else if(o.runType==="llm")a="on_llm_stream",n?.chunk===void 0?i=new pf({text:r}):i=n.chunk;else throw new Error(`Unexpected run type ${o.runType}`);await this.send({event:a,data:{chunk:i},run_id:e.id,name:o.name,tags:o.tags,metadata:o.metadata},o)}}async onLLMEnd(e){let r=this.runInfoMap.get(e.id);this.runInfoMap.delete(e.id);let n;if(r===void 0)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);let o=e.outputs?.generations,i;if(r.runType==="chat_model"){for(let a of o??[]){if(i!==void 0)break;i=a[0]?.message}n="on_chat_model_end"}else if(r.runType==="llm")i={generations:o?.map(a=>a.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},n="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${r.runType}`);await this.sendEndEvent({event:n,data:{output:i,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onChainStart(e){let r=p5(e),n=e.run_type??"chain",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:e.run_type},i={};e.inputs.input===""&&Object.keys(e.inputs).length===1?(i={},o.inputs={}):e.inputs.input!==void 0?(i.input=e.inputs.input,o.inputs=e.inputs.input):(i.input=e.inputs,o.inputs=e.inputs),this.runInfoMap.set(e.id,o),await this.send({event:`on_${n}_start`,data:i,name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onChainEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let n=`on_${e.run_type}_end`,o=e.inputs??r.inputs??{},a={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(a.input=o.input,r.inputs=o.input),await this.sendEndEvent({event:n,data:a,run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(e){let r=p5(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:r,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(r.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let n=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(e){let r=p5(e),n="retriever",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:n,inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});var xLe,m5,w9t,S9t,lp,Rj=C(()=>{xLe=B(yV(),1),m5=B(PV(),1),w9t=[400,401,402,403,404,405,406,407,409],S9t=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&w9t.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},lp=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??S9t;let r="default"in m5.default?m5.default.default:m5.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,xLe.default)(()=>e(...r).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:this.onFailedAttempt,retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>fetch(...e).then(r=>r.ok?r:Promise.reject(r)))}}});var Uq,CLe=C(()=>{yA();Uq=class extends uh{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RootListenersTracer"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnStart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnEnd",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.config=e,this.argOnStart=r,this.argOnEnd=n,this.argOnError=o}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}}});function zq(t){return t?t.lc_runnable:!1}var g5,iue=C(()=>{g5=class{constructor(e){Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=e.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(r)),this.includeTags!==void 0&&(n=n||o.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(r)),this.excludeTags!==void 0&&(n=n&&o.every(i=>!this.excludeTags?.includes(i))),n}}});var ELe,OLe,PLe,y5=C(()=>{ELe=Symbol("Let zodToJsonSchema decide on which parser to use"),OLe={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"},PLe=t=>typeof t=="string"?{...OLe,name:t}:{...OLe,...t}});var TLe,aue=C(()=>{y5();TLe=t=>{let e=PLe(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function sue(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function yn(t,e,r,n,o){t[e]=r,sue(t,e,n,o)}var nE=C(()=>{});function MLe(){return{}}var uue=C(()=>{});function ALe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==ne.ZodAny&&(r.items=kt(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&yn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&yn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(yn(r,"minItems",t.exactLength.value,t.exactLength.message,e),yn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var lue=C(()=>{Pd();nE();ms()});function RLe(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?yn(r,"minimum",n.value,n.message,e):yn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),yn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?yn(r,"maximum",n.value,n.message,e):yn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),yn(r,"maximum",n.value,n.message,e));break;case"multipleOf":yn(r,"multipleOf",n.value,n.message,e);break}return r}var cue=C(()=>{nE()});function ILe(){return{type:"boolean"}}var due=C(()=>{});function b5(t,e){return kt(t.type._def,e)}var _5=C(()=>{ms()});var DLe,fue=C(()=>{ms();DLe=(t,e)=>kt(t.innerType._def,e)});function pue(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>pue(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return x9t(t,e)}}var x9t,hue=C(()=>{nE();x9t=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":yn(r,"minimum",n.value,n.message,e);break;case"max":yn(r,"maximum",n.value,n.message,e);break}return r}});function jLe(t,e){return{...kt(t.innerType._def,e),default:t.defaultValue()}}var mue=C(()=>{ms()});function NLe(t,e){return e.effectStrategy==="input"?kt(t.schema._def,e):{}}var gue=C(()=>{ms()});function LLe(t){return{type:"string",enum:Array.from(t.values)}}var yue=C(()=>{});function FLe(t,e){let r=[kt(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),kt(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(C9t(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 C9t,bue=C(()=>{ms();C9t=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function kLe(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var _ue=C(()=>{});function v5(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":yn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":yn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gm(r,"email",n.message,e);break;case"format:idn-email":Gm(r,"idn-email",n.message,e);break;case"pattern:zod":Id(r,Jm.email,n.message,e);break}break;case"url":Gm(r,"uri",n.message,e);break;case"uuid":Gm(r,"uuid",n.message,e);break;case"regex":Id(r,n.regex,n.message,e);break;case"cuid":Id(r,Jm.cuid,n.message,e);break;case"cuid2":Id(r,Jm.cuid2,n.message,e);break;case"startsWith":Id(r,RegExp(`^${wue(n.value,e)}`),n.message,e);break;case"endsWith":Id(r,RegExp(`${wue(n.value,e)}$`),n.message,e);break;case"datetime":Gm(r,"date-time",n.message,e);break;case"date":Gm(r,"date",n.message,e);break;case"time":Gm(r,"time",n.message,e);break;case"duration":Gm(r,"duration",n.message,e);break;case"length":yn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),yn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Id(r,RegExp(wue(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Gm(r,"ipv4",n.message,e),n.version!=="v4"&&Gm(r,"ipv6",n.message,e);break}case"base64url":Id(r,Jm.base64url,n.message,e);break;case"jwt":Id(r,Jm.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Id(r,Jm.ipv4Cidr,n.message,e),n.version!=="v4"&&Id(r,Jm.ipv6Cidr,n.message,e);break}case"emoji":Id(r,Jm.emoji(),n.message,e);break;case"ulid":{Id(r,Jm.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Gm(r,"binary",n.message,e);break}case"contentEncoding:base64":{yn(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Id(r,Jm.base64,n.message,e);break}}break}case"nanoid":Id(r,Jm.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:(o=>{})(n)}return r}function wue(t,e){return e.patternStrategy==="escape"?E9t(t):t}function E9t(t){let e="";for(let r=0;r<t.length;r++)O9t.has(t[r])||(e+="\\"),e+=t[r];return e}function Gm(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):yn(t,"format",e,r,n)}function Id(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:BLe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):yn(t,"pattern",BLe(e,n),r,n)}function BLe(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}var vue,Jm,O9t,w5=C(()=>{nE();Jm={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-_]*$/};O9t=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function S5(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===ne.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=v5(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===ne.ZodBranded&&t.keyType._def.type._def.typeName===ne.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=b5(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var x5=C(()=>{Pd();ms();w5();_5()});function $Le(t,e){if(e.mapStrategy==="record")return S5(t,e);let r=kt(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var Sue=C(()=>{ms();x5()});function qLe(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}var xue=C(()=>{});function ULe(){return{not:{}}}var Cue=C(()=>{});function zLe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Oue=C(()=>{});function VLe(t,e){if(e.target==="openApi3")return HLe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Hq&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Hq[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 HLe(t,e)}var Hq,HLe,C5=C(()=>{ms();Hq={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};HLe=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>kt(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function WLe(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Hq[t.innerType._def.typeName],nullable:!0}:{type:[Hq[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=kt(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=kt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Eue=C(()=>{ms();C5()});function JLe(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",sue(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?yn(r,"minimum",n.value,n.message,e):yn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),yn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?yn(r,"maximum",n.value,n.message,e):yn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),yn(r,"maximum",n.value,n.message,e));break;case"multipleOf":yn(r,"multipleOf",n.value,n.message,e);break}return r}var Pue=C(()=>{nE()});function P9t(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":kt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":kt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function GLe(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof of&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=kt(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:P9t(t,e)};return n.required.length||delete n.required,n}var Tue=C(()=>{Pd();ms()});var KLe,Mue=C(()=>{ms();KLe=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return kt(t.innerType._def,e);let r=kt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var YLe,Aue=C(()=>{ms();YLe=(t,e)=>{if(e.pipeStrategy==="input")return kt(t.in._def,e);if(e.pipeStrategy==="output")return kt(t.out._def,e);let r=kt(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=kt(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function XLe(t,e){return kt(t.type._def,e)}var Rue=C(()=>{ms()});function ZLe(t,e){let n={type:"array",uniqueItems:!0,items:kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&yn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&yn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Iue=C(()=>{nE();ms()});function QLe(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>kt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:kt(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>kt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Due=C(()=>{ms()});function eFe(){return{not:{}}}var jue=C(()=>{});function tFe(){return{}}var Nue=C(()=>{});var rFe,Lue=C(()=>{ms();rFe=(t,e)=>kt(t.innerType._def,e)});function kt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==ELe)return a}if(n&&!r){let a=T9t(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=A9t(t,t.typeName,e);return i&&R9t(t,e,i),o.jsonSchema=i,i}var T9t,M9t,A9t,R9t,ms=C(()=>{Pd();uue();lue();cue();due();_5();fue();hue();mue();gue();yue();bue();_ue();Sue();xue();Cue();Oue();Eue();Pue();Tue();Mue();Aue();Rue();x5();Iue();w5();Due();jue();C5();Nue();Lue();y5();T9t=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:M9t(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},M9t=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},A9t=(t,e,r)=>{switch(e){case ne.ZodString:return v5(t,r);case ne.ZodNumber:return JLe(t,r);case ne.ZodObject:return GLe(t,r);case ne.ZodBigInt:return RLe(t,r);case ne.ZodBoolean:return ILe();case ne.ZodDate:return pue(t,r);case ne.ZodUndefined:return eFe();case ne.ZodNull:return zLe(r);case ne.ZodArray:return ALe(t,r);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return VLe(t,r);case ne.ZodIntersection:return FLe(t,r);case ne.ZodTuple:return QLe(t,r);case ne.ZodRecord:return S5(t,r);case ne.ZodLiteral:return kLe(t,r);case ne.ZodEnum:return LLe(t);case ne.ZodNativeEnum:return qLe(t);case ne.ZodNullable:return WLe(t,r);case ne.ZodOptional:return KLe(t,r);case ne.ZodMap:return $Le(t,r);case ne.ZodSet:return ZLe(t,r);case ne.ZodLazy:return kt(t.getter()._def,r);case ne.ZodPromise:return XLe(t,r);case ne.ZodNaN:case ne.ZodNever:return ULe();case ne.ZodEffects:return NLe(t,r);case ne.ZodAny:return MLe();case ne.ZodUnknown:return tFe();case ne.ZodDefault:return jLe(t,r);case ne.ZodBranded:return b5(t,r);case ne.ZodReadonly:return rFe(t,r);case ne.ZodCatch:return DLe(t,r);case ne.ZodPipeline:return YLe(t,r);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return(n=>{})(e)}},R9t=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Bi,Fue=C(()=>{ms();aue();Bi=(t,e)=>{let r=TLe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:kt(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=kt(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s}});var hh=C(()=>{y5();aue();nE();ms();uue();lue();cue();due();_5();fue();hue();mue();gue();yue();bue();_ue();Sue();xue();Cue();Oue();Eue();Pue();Tue();Mue();Aue();Rue();Lue();x5();Iue();w5();Due();jue();C5();Nue();Fue();Fue()});function kue(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function D9t(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function nFe(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
graph TD;
`:`graph TD;
`;if(a){let p="default",h={[p]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[m,v]of Object.entries(t)){let g=v.name.split(":").pop()??"",S=I9t.some(O=>g.startsWith(O)&&g.endsWith(O))?`<p>${g}</p>`:g;Object.keys(v.metadata??{}).length&&(S+=`<hr/><small><em>${Object.entries(v.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 e){let h=p.source.split(":"),m=p.target.split(":"),v=h.filter((g,_)=>g===m[_]).join(":");c[v]||(c[v]=[]),c[v].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 v=h.split(":").pop();if(d.has(v))throw new Error(`Found duplicate subgraph '${v}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(v),l+=` subgraph ${v}
`}for(let v of p){let{source:g,target:_,data:S,conditional:x}=v,O="";if(S!==void 0){let T=S,E=T.split(" ");E.length>u&&(T=Array.from({length:Math.ceil(E.length/u)},(M,R)=>E.slice(R*u,(R+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),O=x?` -. &nbsp;${T}&nbsp; .-> `:` -- &nbsp;${T}&nbsp; --> `}else O=x?" -.-> ":" --> ";l+=` ${kue(g)}${O}${kue(_)};
`}for(let v in c)v.startsWith(`${h}:`)&&v!==h&&f(c[v],v);h&&!m&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=D9t(i??{})),l}async function oFe(t,e){let{backgroundColor:r="white"}=e??{},n=btoa(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let o=`https://mermaid.ink/img/${n}?bgColor=${r}`,i=await fetch(o);if(!i.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${i.status}`,`Status text: ${i.statusText}`].join(`
`));return await i.blob()}var I9t,iFe=C(()=>{I9t=["*","_","`"]});function j9t(t,e){if(t!==void 0&&!gj(t))return t;if(zq(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function N9t(t){return zq(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Bi(t.data.schema),title:t.data.name}}}function aFe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function sFe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}var wA,uFe=C(()=>{hh();_q();iue();iFe();wA=class{constructor(e){Object.defineProperty(this,"nodes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"edges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=gj(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...N9t(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??af(),i={id:o,data:e,name:j9t(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return aFe(this)}lastNode(){return sFe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(gj)&&(n="");let i=l=>n?`${n}:${l}`:l;Object.entries(e.nodes).forEach(([l,c])=>{this.nodes[i(l)]={...c,id:i(l)}});let a=e.edges.map(l=>({...l,source:i(l.source),target:i(l.target)}));this.edges=[...this.edges,...a];let s=e.firstNode(),u=e.lastNode();return[s?{id:i(s.id),data:s.data}:void 0,u?{id:i(u.id),data:u.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&aFe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&sFe(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return gj(o)&&r.get(i)===1?i:o};return new wA({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),s=a.firstNode(),u=a.lastNode();return nFe(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return oFe(r,{backgroundColor:e?.backgroundColor})}}});function lFe(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data
data: ${JSON.stringify(o)}
`));n.enqueue(e.encode(`event: end
`)),n.close()}});return Ku.fromReadableStream(r)}var cFe=C(()=>{Ty()});function Bue(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function O5(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*$ue(t,e){for(;;){let{value:r,done:n}=Hc.runWithConfig(up(t),e.next.bind(e),!0);if(n)break;yield r}}async function*E5(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Hc.runWithConfig(up(t),r.next.bind(e),!0);if(o)break;yield n}}var dFe,fFe=C(()=>{Mj();Ey();dFe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Yu(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function L9t(t){if(KV(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function nx(t){if(typeof t=="function")return new Ym({func:t});if(nn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=nx(n);return new My({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function F9t(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Pr.ZodString?new Wq({name:r,description:n,schema:Pr.object({input:Pr.string()}).transform(o=>o.input),bound:t}):new Wq({name:r,description:n,schema:e.schema,bound:t})}var que,nn,Km,SA,P5,ai,My,Vq,Ym,T5,Ij,M5,Wq,hf=C(()=>{Pd();que=B(yV(),1);_q();Rse();vLe();SLe();mA();Ty();nue();Ey();Rj();CLe();iue();Mj();uFe();cFe();fFe();o5();nn=class extends zc{constructor(){super(...arguments),Object.defineProperty(this,"lc_runnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}bind(e){return new Km({bound:this,kwargs:e,config:{}})}map(){return new SA({bound:this})}withRetry(e){return new P5({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Km({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new T5({runnable:this,fallbacks:r})}_getOptionsList(e,r=0){if(Array.isArray(e)&&e.length!==r)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${r} inputs`);if(Array.isArray(e))return e.map(jr);if(r>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let n=Object.fromEntries(Object.entries(e).filter(([o])=>o!=="runId"));return Array.from({length:r},(o,i)=>jr(i===0?e:n))}return Array.from({length:r},()=>jr(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new lp({maxConcurrency:i,onFailedAttempt:u=>{throw u}}),s=e.map((u,l)=>a.call(async()=>{try{return await this.invoke(u,o[l])}catch(c){if(n?.returnExceptions)return c;throw c}}));return Promise.all(s)}async*_streamIterator(e,r){yield this.invoke(e,r)}async stream(e,r){let n=jr(r),o=new rx({generator:this._streamIterator(e,n),config:n});return await o.setup,Ku.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=jr(e):r=jr({callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});let n={...e};return delete n.callbacks,delete n.tags,delete n.metadata,delete n.runName,delete n.configurable,delete n.recursionLimit,delete n.maxConcurrency,delete n.runId,delete n.timeout,delete n.signal,[r,n]}async _callWithConfig(e,r,n){let o=jr(n),a=await(await ff(o))?.handleChainStart(this.toJSON(),Yu(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{let u=e.call(this,r,o,a);s=await Py(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(Yu(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(ff)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Yu(r[c],"input"),i[c].runId,i[c].runType,void 0,void 0,i[c].runName??this.getName());return delete i[c].runId,d})),u;try{let l=e.call(this,r,i,s,o);u=await Py(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(Yu(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=jr(n),l=await ff(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=yl(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await gLe(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(_Le);m!==void 0&&d!==void 0&&(h=m.tapOutputIterable(d.runId,h));for await(let v of h)if(yield v,s)if(a===void 0)a=v;else try{a=yl(a,v)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Yu(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:Yu(o,"input")})}getGraph(e){let r=new wA,n=r.addNode({name:`${this.getName()}Input`,schema:Pr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Pr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new ai({first:this,last:nx(e)})}pick(e){return this.pipe(new M5(e))}assign(e){return this.pipe(new Ij(new My({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=yl(n,o);yield*this._streamIterator(n,jr(r))}async*streamLog(e,r,n){let o=new $q({...n,autoClose:!1,_schemaFormat:"original"}),i=jr(r);yield*this._streamLog(e,o,i)}async*_streamLog(e,r,n){let{callbacks:o}=n;if(o===void 0)n.callbacks=[r];else if(Array.isArray(o))n.callbacks=o.concat([r]);else{let u=o.copy();u.addHandler(r,!0),n.callbacks=u}let i=this.stream(e,n);async function a(){try{let u=await i;for await(let l of u){let c=new Wm({ops:[{op:"add",path:"/streamed_output/-",value:l}]});await r.writer.write(c)}}finally{await r.writer.close()}}let s=a();try{for await(let u of r)yield u}finally{await s}}streamEvents(e,r,n){let o;if(r.version==="v1")o=this._streamEventsV1(e,r,n);else if(r.version==="v2")o=this._streamEventsV2(e,r,n);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return r.encoding==="text/event-stream"?lFe(o):Ku.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new h5({...n,autoClose:!1}),i=jr(r),a=i.runId??af();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(e,{...i,signal:h}),v=o.tapOutputIterable(a,m);for await(let g of v)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let h of o){if(!f){h.data.input=e,f=!0,p=h.run_id,yield h;continue}h.run_id===p&&h.event.endsWith("_end")&&h.data?.input&&delete h.data.input,yield h}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=jr(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new $q({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new g5({...n}),f=this._streamLog(e,c,a);for await(let h of f){if(o?o=o.concat(h):o=rE.fromRunLogPatch(h),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let _={...o.state},S={run_id:_.id,event:`on_${_.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(S,_.type)&&(yield S)}let m=h.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),v=[...new Set(m)];for(let _ of v){let S,x={},O=o.state.logs[_];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 _=g.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} 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(e){return zq(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Km({bound:this,config:{},configFactories:[o=>({callbacks:[new Uq({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return F9t(this,e)}},Km=class extends nn{static lc_name(){return"RunnableBinding"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"configFactories",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=f5(this.config,...e);return f5(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(e){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...e},config:this.config})}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new this.constructor({bound:this.bound.withRetry(e),kwargs:this.kwargs,config:this.config})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(jr(r),this.kwargs))}async batch(e,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(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(jr(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(jr(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(jr(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(jr(r),o.kwargs),version:r.version},n)};return Ku.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&nn.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new Km({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new Uq({config:o,onStart:e,onEnd:r,onError:n})]})]})}},SA=class extends nn{static lc_name(){return"RunnableEach"}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound}bind(e){return new SA({bound:this.bound.bind(e)})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,La(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new SA({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},P5=class extends Km{static lc_name(){return"RunnableRetry"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"maxAttemptNumber",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,r,n){let o=e>1?`retry:attempt:${e}`:void 0;return La(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,que.default)(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:o=>this.onFailedAttempt(o,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _batch(e,r,n,o){let i={};try{await(0,que.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],h=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[h.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},ai=class extends nn{static lc_name(){return"RunnableSequence"}constructor(e){super(e),Object.defineProperty(this,"first",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"middle",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"last",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitSequenceTags",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=jr(r),i=await(await ff(n))?.handleChainStart(this.toJSON(),Yu(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=e,s;try{let u=[this.first,...this.middle];for(let l=0;l<u.length;l+=1){let d=u[l].invoke(a,La(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await Py(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,La(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(Yu(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(ff)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Yu(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s=e;try{for(let u=0;u<this.steps.length;u+=1){let c=this.steps[u].batch(s,a.map((d,f)=>{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return La(o[f],{callbacks:p})}),n);s=await Py(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(Yu(s,"output")))),s}async*_streamIterator(e,r){let n=await ff(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),Yu(e,"input"),o,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],u=!0,l;async function*c(){yield e}try{let d=s[0].transform(c(),La(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,La(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,u)if(l===void 0)l=f;else try{l=yl(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(Yu(l,"output"))}getGraph(e){let r=new wA,n=null;return this.steps.forEach((o,i)=>{let a=o.getGraph(e);i!==0&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),r.extend(a);let s=a.firstNode();if(!s)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,s),n=a.lastNode()}),r}pipe(e){return ai.isRunnableSequence(e)?new ai({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new ai({first:this.first,middle:[...this.middle,this.last],last:nx(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&nn.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new ai({...o,first:nx(e),middle:r.slice(0,-1).map(nx),last:nx(r[r.length-1])})}},My=class extends nn{static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"steps",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=nx(n)}static from(e){return new My({steps:e})}async invoke(e,r){let n=jr(r),i=await(await ff(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a={};try{let s=Object.entries(this.steps).map(async([u,l])=>{a[u]=await l.invoke(e,La(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Py(Promise.all(s),r?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(e,r,n){let o={...this.steps},i=oue(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],La(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 Py(s,n?.signal);a.delete(u),l.done||(yield{[u]:l.value},a.set(u,c.next().then(d=>({key:u,gen:c,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=jr(r),i=new rx({generator:this.transform(n(),o),config:o});return await i.setup,Ku.fromAsyncGenerator(i)}},Vq=class extends nn{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!KV(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await ff(n),i=this.func(La(n,{callbacks:o}),e);return Py(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(O5(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(dFe(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new Vq({func:e})}};Ym=class extends nn{static lc_name(){return"RunnableLambda"}constructor(e){if(KV(e.func))return Vq.from(e.func);super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),L9t(e.func),this.func=e.func}static from(e){return new Ym({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let a=La(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??d5)-1});Hc.runWithConfig(up(a),async()=>{try{let s=await this.func(e,{...a});if(s&&nn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??d5)-1})}else if(O5(s)){let u;for await(let l of E5(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=yl(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=yl(u,l)}catch{u=l}s=u}o(s)}catch(s){i(s)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let s of e)if(o===void 0)o=s;else try{o=yl(o,s)}catch{o=s}let i=La(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??d5)-1}),a=await new Promise((s,u)=>{Hc.runWithConfig(up(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&nn.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(O5(a))for await(let s of E5(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(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=jr(r),i=new rx({generator:this.transform(n(),o),config:o});return await i.setup,Ku.fromAsyncGenerator(i)}},T5=class extends nn{static lc_name(){return"RunnableWithFallbacks"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"runnable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fallbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,r){let n=jr(r),o=await ff(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Yu(e,"input"),i,void 0,void 0,void 0,a?.runName),u=La(a,{callbacks:s?.getChild()});return await Hc.runWithConfig(u,async()=>{let c;for(let d of this.runnables()){n?.signal?.throwIfAborted();try{let f=await d.invoke(e,u);return await s?.handleChainEnd(Yu(f,"output")),f}catch(f){c===void 0&&(c=f)}}throw c===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(c),c)})}async*_streamIterator(e,r){let n=jr(r),o=await ff(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Yu(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=La(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=E5(f,p);break}catch(p){u===void 0&&(u=p)}}if(l===void 0){let d=u??new Error("No error stored at end of fallback.");throw await s?.handleChainError(d),d}let c;try{for await(let d of l){yield d;try{c=c===void 0?c:yl(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(Yu(c,"output"))}async batch(e,r,n){if(n?.returnExceptions)throw new Error("Not implemented.");let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(u=>ff(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Yu(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s;for(let u of this.runnables()){o[0].signal?.throwIfAborted();try{let l=await u.batch(e,a.map((c,d)=>La(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(Yu(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.")}};Ij=class extends nn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof My&&(e={mapper:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"mapper",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.mapper=e.mapper}async invoke(e,r){let n=await this.mapper.invoke(e,r);return{...e,...n}}async*_transform(e,r,n){let o=this.mapper.getStepsKeys(),[i,a]=oue(e),s=this.mapper.transform(a,La(n,{callbacks:r?.getChild()})),u=s.next();for await(let l of i){if(typeof l!="object"||Array.isArray(l))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof l}`);let c=Object.fromEntries(Object.entries(l).filter(([d])=>!o.includes(d)));Object.keys(c).length>0&&(yield c)}yield(await u).value;for await(let l of s)yield l}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=jr(r),i=new rx({generator:this.transform(n(),o),config:o});return await i.setup,Ku.fromAsyncGenerator(i)}},M5=class extends nn{static lc_name(){return"RunnablePick"}constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"keys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keys=e.keys}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let r=this.keys.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0);return r.length===0?void 0:Object.fromEntries(r)}}async invoke(e,r){return this._callWithConfig(this._pick.bind(this),e,r)}async*_transform(e){for await(let r of e){let n=await this._pick(r);n!==void 0&&(yield n)}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=jr(r),i=new rx({generator:this.transform(n(),o),config:o});return await i.setup,Ku.fromAsyncGenerator(i)}},Wq=class extends Km{constructor(e){let r=ai.from([Ym.from(async n=>{let o;if(Oj(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new Cj("Received tool input did not match expected schema",JSON.stringify(n.args))}else o=n;return o}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:r,config:e.config??{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var $i,A5=C(()=>{Ty();hf();Ey();$i=class extends nn{static lc_name(){return"RunnablePassthrough"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e&&(this.func=e.func)}async invoke(e,r){let n=jr(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=jr(r),o,i=!0;for await(let a of this._transformStreamWithConfig(e,s=>s,n))if(yield a,i)if(o===void 0)o=a;else try{o=yl(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new Ij(new My({steps:e}))}}});var pFe=C(()=>{hf();Ey()});var hFe=C(()=>{hf();Ey();Ty()});var Uue=C(()=>{fh()});var mFe=C(()=>{hf();bA();fh();i5();a5();Lq();Uue();s5();Pj();ZO()});var xA=C(()=>{bA();fh();i5();a5();Lq();s5();ZO();mFe();Uue();Pj()});var gFe=C(()=>{xA();hf();A5()});var zue=C(()=>{hf();Ey();A5();pFe();hFe();gFe()});var CA,OA,cp,Dj=C(()=>{zue();jq();CA=class extends nn{parseResultWithPrompt(e,r,n){return this.parseResult(e,n)}_baseMessageToString(e){return typeof e.content=="string"?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,r){return typeof e=="string"?this._callWithConfig(async(n,o)=>this.parseResult([{text:n}],o?.callbacks),e,{...r,runType:"parser"}):this._callWithConfig(async(n,o)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],o?.callbacks),e,{...r,runType:"parser"})}},OA=class extends CA{parseResult(e,r){return this.parse(e[0].text,r)}async parseWithPrompt(e,r,n){return this.parse(e,n)}_type(){throw new Error("_type not implemented")}},cp=class extends Error{constructor(e,r,n,o=!1){if(super(e),Object.defineProperty(this,"llmOutput",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"observation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendToLLM",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmOutput=r,this.observation=n,this.sendToLLM=o,o&&(n===void 0||r===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");XO(this,"OUTPUT_PARSING_FAILURE")}}});function Jq(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o<n;o++)if(!Jq(t[o],e[o]))return!1;return!0}if(r==="object"){if(!t||!e)return t===e;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let a of n)if(!Jq(t[a],e[a]))return!1;return!0}return t===e}var Hue=C(()=>{});var R5=C(()=>{});var hxn,I5=C(()=>{R5();hxn=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 mf(t){return t.test.bind(t)}function aWt(t){return t%4===0&&(t%100!==0||t%400===0)}function yFe(t){let e=t.match(B9t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&aWt(r)?29:$9t[n])}function bFe(t,e){let r=e.match(q9t);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],a=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||a)}function uWt(t){let e=t.split(sWt);return e.length==2&&yFe(e[0])&&bFe(!0,e[1])}function dWt(t){return lWt.test(t)&&cWt.test(t)}function pWt(t){if(fWt.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var B9t,$9t,q9t,U9t,z9t,H9t,V9t,W9t,J9t,G9t,K9t,Y9t,X9t,Z9t,Q9t,eWt,tWt,rWt,nWt,oWt,iWt,sWt,lWt,cWt,fWt,Vue=C(()=>{B9t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$9t=[0,31,28,31,30,31,30,31,31,30,31,30,31],q9t=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,U9t=/^(?=.{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,z9t=/^(?:[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,H9t=/^(?:(?:[^\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,V9t=/^(?:(?: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,W9t=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,J9t=/^(?:\/(?:[^~/]|~0|~1)*)*$/,G9t=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,K9t=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Y9t=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,X9t=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Z9t=/^\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,Q9t=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,eWt=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},tWt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,rWt=/^((([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,nWt=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));oWt={date:yFe,time:bFe.bind(void 0,!1),"date-time":uWt,duration:nWt,uri:dWt,"uri-reference":mf(z9t),"uri-template":mf(H9t),url:mf(V9t),email:eWt,hostname:mf(U9t),ipv4:mf(tWt),ipv6:mf(rWt),regex:pWt,uuid:mf(W9t),"json-pointer":mf(J9t),"json-pointer-uri-fragment":mf(G9t),"relative-json-pointer":mf(K9t)},iWt={...oWt,date:mf(Y9t),time:mf(X9t),"date-time":mf(Z9t),"uri-reference":mf(Q9t)};sWt=/t|\s/i;lWt=/\/|:/,cWt=/^(?:[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;fWt=/[^\\]\\Z/});var _Fe,vFe=C(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(_Fe||(_Fe={}))});var Wue=C(()=>{});var Jue=C(()=>{Hue();I5();Vue();R5();Wue()});var wFe=C(()=>{I5();Jue()});var SFe=C(()=>{Hue();I5();Vue();R5();vFe();Wue();Jue();wFe()});var EA,PA,oE=C(()=>{SFe();Dj();fh();ZO();Aj();EA=class extends OA{async*_transform(e){for await(let r of e)typeof r=="string"?yield this.parseResult([{text:r}]):yield this.parseResult([{message:r,text:this._baseMessageToString(r)}])}async*transform(e,r){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...r,runType:"parser"})}},PA=class extends EA{constructor(e){super(e),Object.defineProperty(this,"diff",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.diff=e?.diff??this.diff}async*_transform(e){let r,n;for await(let o of e){if(typeof o!="string"&&typeof o.content!="string")throw new Error("Cannot handle non-string output.");let i;if(Hse(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Ho({message:o,text:o.content})}else if(dh(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Ho({message:Jse(o),text:o.content})}else i=new pf({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!Jq(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var xFe=C(()=>{oE()});var CFe=C(()=>{Dj();oE()});var D5,OFe=C(()=>{oE();D5=class extends EA{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers","string"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"StrOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}_textContentToString(e){return e.text}_imageUrlContentToString(e){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentComplexToString(e){switch(e.type){case"text":case"text_delta":if("text"in e)return this._textContentToString(e);break;case"image_url":if("image_url"in e)return this._imageUrlContentToString(e);break;default:throw new Error(`Cannot coerce "${e.type}" message part into a string.`)}throw new Error(`Invalid content type: ${e.type}`)}_baseMessageContentToString(e){return e.reduce((r,n)=>r+this._messageContentComplexToString(n),"")}}});var ox,EFe=C(()=>{Pd();hh();Dj();ox=class extends OA{static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","structured"]})}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let r=Pr.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Pr.string().describe(o)])));return new this(r)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}}}
would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
\`\`\`json
${JSON.stringify(Bi(this.schema))}
\`\`\`
`}async parse(e){try{let n=(e.includes("```")?e.trim().split(/```(?:json)?/)[1]:e.trim()).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await this.schema.parseAsync(JSON.parse(n))}catch(r){throw new cp(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var Gue=C(()=>{Dse()});var ix,Kue=C(()=>{oE();Gue();zse();ix=class extends PA{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"JsonOutputParser"}_diff(e,r){if(r)return e?n5(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Use(e[0].text)}async parse(e){return Use(e,JSON.parse)}getFormatInstructions(){return""}}});var PFe=C(()=>{});var TFe=C(()=>{oE();Gue();PFe()});var MFe=C(()=>{Dj();xFe();CFe();OFe();EFe();oE();Kue();TFe()});var iE=C(()=>{MFe()});var Gq,jj,Nj,j5,Kq=C(()=>{mA();Lq();ZO();Gq=class extends zc{},jj=class extends Gq{static lc_name(){return"StringPromptValue"}constructor(e){super({value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=e}toString(){return this.value}toChatMessages(){return[new Qa(this.value)]}},Nj=class extends Gq{static lc_name(){return"ChatPromptValue"}constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.messages=e.messages}toString(){return df(this.messages)}toChatMessages(){return this.messages}},j5=class extends Gq{static lc_name(){return"ImagePromptValue"}constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"imageUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new Qa({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var ax,Yq=C(()=>{Kq();Lj();ax=class extends Ay{async formatPromptValue(e){let r=await this.format(e);return new jj(r)}}});function Xue(t){return typeof t=="function"}function gWt(t){return kj(t)?"array":typeof t}function Yue(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function AFe(t,e){return t!=null&&typeof t=="object"&&e in t}function yWt(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function _Wt(t,e){return bWt.call(t,e)}function wWt(t){return!_Wt(vWt,t)}function xWt(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return SWt[r]})}function TWt(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function h(M){if(typeof M=="string"&&(M=M.split(OWt,2)),!kj(M)||M.length!==2)throw new Error("Invalid tags: "+M);d=new RegExp(Yue(M[0])+"\\s*"),f=new RegExp("\\s*"+Yue(M[1])),p=new RegExp("\\s*"+Yue("}"+M[1]))}h(e||mh.tags);for(var m=new Zq(t),v,g,_,S,x,O;!m.eos();){if(v=m.pos,_=m.scanUntil(d),_)for(var T=0,E=_.length;T<E;++T)S=_.charAt(T),wWt(S)?(i.push(o.length),u+=S):(s=!0,r=!0,u+=" "),o.push(["text",S,v,v+1]),v+=1,S===`
`&&(c(),u="",l=0,r=!1);if(!m.scan(d))break;if(a=!0,g=m.scan(PWt)||"name",m.scan(CWt),g==="="?(_=m.scanUntil(RFe),m.scan(RFe),m.scanUntil(f)):g==="{"?(_=m.scanUntil(p),m.scan(EWt),m.scanUntil(f),g="&"):_=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 "'+_+'" at '+v);if(O[1]!==_)throw new Error('Unclosed section "'+O[1]+'" at '+v)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&h(_)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+m.pos);return AWt(MWt(o))}function MWt(t){for(var e=[],r,n,o=0,i=t.length;o<i;++o)r=t[o],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function AWt(t){for(var e=[],r=e,n=[],o,i,a=0,s=t.length;a<s;++a)switch(o=t[a],o[0]){case"#":case"^":r.push(o),n.push(o),r=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(o)}return e}function Zq(t){this.string=t,this.tail=t,this.pos=0}function Fj(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Dd(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var mWt,kj,bWt,vWt,SWt,CWt,OWt,RFe,EWt,PWt,mh,Xq,N5,IFe=C(()=>{mWt=Object.prototype.toString,kj=Array.isArray||function(e){return mWt.call(e)==="[object Array]"};bWt=RegExp.prototype.test;vWt=/\S/;SWt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};CWt=/\s*/,OWt=/\s+/,RFe=/\s*=/,EWt=/\s*\}/,PWt=/#|\^|\/|>|\{|&|=|!/;Zq.prototype.eos=function(){return this.tail===""};Zq.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};Zq.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};Fj.prototype.push=function(e){return new Fj(e,this)};Fj.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var o=this,i,a,s,u=!1;o;){if(e.indexOf(".")>0)for(i=o.view,a=e.split("."),s=0;i!=null&&s<a.length;)s===a.length-1&&(u=AFe(i,a[s])||yWt(i,a[s])),i=i[a[s++]];else i=o.view[e],u=AFe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return Xue(n)&&(n=n.call(this.view)),n};Dd.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Dd.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||mh.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=TWt(e,r),i&&n.set(o,a)),a};Dd.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof Fj?r:new Fj(r,void 0);return this.renderTokens(a,s,n,e,o)};Dd.prototype.renderTokens=function(e,r,n,o,i){for(var a="",s,u,l,c=0,d=e.length;c<d;++c)l=void 0,s=e[c],u=s[0],u==="#"?l=this.renderSection(s,r,n,o,i):u==="^"?l=this.renderInverted(s,r,n,o,i):u===">"?l=this.renderPartial(s,r,n,i):u==="&"?l=this.unescapedValue(s,r):u==="name"?l=this.escapedValue(s,r,i):u==="text"&&(l=this.rawValue(s)),l!==void 0&&(a+=l);return a};Dd.prototype.renderSection=function(e,r,n,o,i){var a=this,s="",u=r.lookup(e[1]);function l(f){return a.render(f,r,n,i)}if(u){if(kj(u))for(var c=0,d=u.length;c<d;++c)s+=this.renderTokens(e[4],r.push(u[c]),n,o,i);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")s+=this.renderTokens(e[4],r.push(u),n,o,i);else if(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(e[3],e[5]),l),u!=null&&(s+=u)}else s+=this.renderTokens(e[4],r,n,o,i);return s}};Dd.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||kj(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Dd.prototype.indentPartial=function(e,r,n){for(var o=r.replace(/[^ \t]/g,""),i=e.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=o+i[a]);return i.join(`
`)};Dd.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=Xue(n)?n(e[1]):n[e[1]];if(a!=null){var s=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,s));var d=this.parse(c,i);return this.renderTokens(d,r,n,c,o)}}};Dd.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Dd.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||mh.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===mh.escape?String(i):o(i)};Dd.prototype.rawValue=function(e){return e[1]};Dd.prototype.getConfigTags=function(e){return kj(e)?e:e&&typeof e=="object"?e.tags:void 0};Dd.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!kj(e))return e.escape};mh={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Xq.templateCache=t},get templateCache(){return Xq.templateCache}},Xq=new Dd;mh.clearCache=function(){return Xq.clearCache()};mh.parse=function(e,r){return Xq.parse(e,r)};mh.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+gWt(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Xq.render(e,r,n,o)};mh.escape=xWt;mh.Scanner=Zq;mh.Context=Fj;mh.Writer=Dd;N5=mh});function DFe(){N5.escape=t=>t}var Qq,RWt,L5,IWt,DWt,Zue,jWt,Xm,jFe,TA,Bj=C(()=>{IFe();jq();Qq=t=>{let e=t.split(""),r=[],n=(i,a)=>{for(let s=a;s<e.length;s+=1)if(i.includes(e[s]))return s;return-1},o=0;for(;o<e.length;)if(e[o]==="{"&&o+1<e.length&&e[o+1]==="{")r.push({type:"literal",text:"{"}),o+=2;else if(e[o]==="}"&&o+1<e.length&&e[o+1]==="}")r.push({type:"literal",text:"}"}),o+=2;else if(e[o]==="{"){let i=n("}",o);if(i<0)throw new Error("Unclosed '{' in template.");r.push({type:"variable",name:e.slice(o+1,i).join("")}),o=i+1}else{if(e[o]==="}")throw new Error("Single '}' in template.");{let i=n("{}",o),a=(i<0?e.slice(o):e.slice(o,i)).join("");r.push({type:"literal",text:a}),o=i<0?e.length:i}}return r},RWt=t=>t.map(e=>e[0]==="name"?{type:"variable",name:e[1].includes(".")?e[1].split(".")[0]:e[1]}:["#","&","^",">"].includes(e[0])?{type:"variable",name:e[1]}:{type:"literal",text:e[1]}),L5=t=>{DFe();let e=N5.parse(t);return RWt(e)},IWt=(t,e)=>Qq(t).reduce((r,n)=>{if(n.type==="variable"){if(n.name in e){let o=typeof e[n.name]=="string"?e[n.name]:JSON.stringify(e[n.name]);return r+o}throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),DWt=(t,e)=>(DFe(),N5.render(t,e)),Zue={"f-string":IWt,mustache:DWt},jWt={"f-string":Qq,mustache:L5},Xm=(t,e,r)=>{try{return Zue[e](t,r)}catch(n){throw XO(n,"INVALID_PROMPT_INPUT")}},jFe=(t,e)=>jWt[e](t),TA=(t,e,r)=>{if(!(e in Zue)){let n=Object.keys(Zue);throw new Error(`Invalid template format. Got \`${e}\`;
should be one of ${n}`)}try{let n=r.reduce((o,i)=>(o[i]="foo",o),{});Array.isArray(t)?t.forEach(o=>{if(o.type==="text")Xm(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Xm(o.image_url,e,n);else{let i=o.image_url.url;Xm(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Xm(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var Que={};nf(Que,{PromptTemplate:()=>gs});var gs,$j=C(()=>{Yq();Bj();gs=class extends ax{static lc_name(){return"PromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),TA(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Xm(this.template,this.templateFormat,r)}static fromExamples(e,r,n,o=`
`,i=""){let a=[i,...e,r].join(o);return new gs({inputVariables:n,template:a})}static fromTemplate(e,r){let{templateFormat:n="f-string",...o}=r??{},i=new Set;return jFe(e,n).forEach(a=>{a.type==="variable"&&i.add(a.name)}),new gs({inputVariables:[...i],templateFormat:n,template:e,...o})}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new gs(o)}serialize(){if(this.outputParser!==void 0)throw new Error("Cannot serialize a prompt template with an output parser");return{_type:this._getPromptType(),input_variables:this.inputVariables,template:this.template,template_format:this.templateFormat}}static async deserialize(e){if(!e.template)throw new Error("Prompt template must have a template");return new gs({inputVariables:e.input_variables,template:e.template,templateFormat:e.template_format})}}});var aE,ele=C(()=>{Kq();Lj();Bj();aE=class extends Ay{static lc_name(){return"ImagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","image"]}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=e.templateFormat??this.templateFormat,this.validateTemplate=e.validateTemplate??this.validateTemplate,this.additionalContentFields=e.additionalContentFields,this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),TA([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new aE(o)}async format(e){let r={};for(let[a,s]of Object.entries(this.template))typeof s=="string"?r[a]=Xm(s,this.templateFormat,e):r[a]=s;let n=e.url||r.url,o=e.detail||r.detail;if(!n)throw new Error("Must provide either an image URL.");if(typeof n!="string")throw new Error("url must be a string.");let i={url:n};return o&&(i.detail=o),i}async formatPromptValue(e){let r=await this.format(e);return new j5(r)}}});function NWt(t){return typeof t.formatMessages=="function"}function LWt(t,e){if(NWt(t)||dh(t))return t;if(Array.isArray(t)&&t[0]==="placeholder"){let o=t[1];if(e?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new sE({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new sE({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${e?.templateFormat??'"f-string"'}: "${t[1]}". Expected a variable name surrounded by ${e?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Vm(t),n;if(typeof r.content=="string"?n=r.content:n=r.content.map(o=>"text"in o?{...o,text:o.text}:"image_url"in o?{...o,image_url:o.image_url}:o),r._getType()==="human")return uE.fromTemplate(n,e);if(r._getType()==="ai")return nle.fromTemplate(n,e);if(r._getType()==="system")return qj.fromTemplate(n,e);if(Gl.isInstance(r))return rle.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function FWt(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var eU,sE,tle,tU,rle,rU,uE,nle,qj,Vc,nU=C(()=>{xA();Kq();hf();Yq();Lj();$j();ele();Bj();jq();eU=class extends nn{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},sE=class extends eU{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let r=e[this.variableName];if(this.optional&&!r)return[];if(!r){let o=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw o.name="InputFormatError",o}let n;try{Array.isArray(r)?n=r.map(Vm):n=[Vm(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}},tle=class extends eU{constructor(e){"prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},tU=class extends Ay{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new Nj(r)}},rle=class extends tle{static lc_name(){return"ChatMessagePromptTemplate"}constructor(e,r){"prompt"in e||(e={prompt:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}async format(e){return new Gl(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(gs.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}},rU=class extends eU{static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}constructor(e,r){if("prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"additionalOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"messageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chatMessageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt,Array.isArray(this.prompt)){let n=[];this.prompt.forEach(o=>{"inputVariables"in o&&(n=n.concat(o.inputVariables))}),this.inputVariables=n}else this.inputVariables=this.prompt.inputVariables;this.additionalOptions=r??this.additionalOptions}createMessage(e){let r=this.constructor;if(r._messageClass()){let n=r._messageClass();return new n({content:e})}else if(r.chatMessageClass){let n=r.chatMessageClass();return new n({content:e,role:this.getRoleFromMessageClass(n.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(e){switch(e){case"HumanMessage":return"human";case"AIMessage":return"ai";case"SystemMessage":return"system";case"ChatMessage":return"chat";default:throw new Error("Invalid message class name")}}static fromTemplate(e,r){if(typeof e=="string")return new this(gs.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string"||typeof o=="object"&&"text"in o){let i="";typeof o=="string"?i=o:typeof o.text=="string"&&(i=o.text??"");let a={...r,...typeof o!="string"?{additionalContentFields:o}:{}};n.push(gs.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=L5(i):u=Qq(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 aE({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=L5(i.url):u=Qq(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new aE({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof ax){let r=await this.prompt.format(e);return this.createMessage(r)}else{let r=[];for(let n of this.prompt){let o={};if(!("inputVariables"in n))throw new Error(`Prompt ${n} does not have inputVariables defined.`);for(let i of n.inputVariables)o||(o={[i]:e[i]}),o={...o,[i]:e[i]};if(n instanceof ax){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof aE){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}}return this.createMessage(r)}}async formatMessages(e){return[await this.format(e)]}},uE=class extends rU{static _messageClass(){return Qa}static lc_name(){return"HumanMessagePromptTemplate"}},nle=class extends rU{static _messageClass(){return To}static lc_name(){return"AIMessagePromptTemplate"}},qj=class extends rU{static _messageClass(){return tx}static lc_name(){return"SystemMessagePromptTemplate"}};Vc=class extends tU{static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}constructor(e){if(super(e),Object.defineProperty(this,"promptMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){let r=new Set;for(let s of this.promptMessages)if(!(s instanceof Ju))for(let u of s.inputVariables)r.add(u);let n=this.inputVariables,o=new Set(this.partialVariables?n.concat(Object.keys(this.partialVariables)):n),i=new Set([...o].filter(s=>!r.has(s)));if(i.size>0)throw new Error(`Input variables \`${[...i]}\` are not used in any of the prompt messages.`);let a=new Set([...r].filter(s=>!o.has(s)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are used in prompt messages but not in the prompt template.`)}}_getPromptType(){return"chat"}async _parseImagePrompts(e,r){if(typeof e.content=="string")return e;let n=await Promise.all(e.content.map(async o=>{if(o.type!=="image_url")return o;let i="";typeof o.image_url=="string"?i=o.image_url:i=o.image_url.url;let s=await gs.fromTemplate(i,{templateFormat:this.templateFormat}).format(r);return typeof o.image_url!="string"&&"url"in o.image_url?o.image_url.url=s:o.image_url=s,o}));return e.content=n,e}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=[];for(let o of this.promptMessages)if(o instanceof Ju)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(FWt(o)&&o.optional))throw XO(new Error(`Missing value for input variable \`${u.toString()}\``),"INVALID_PROMPT_INPUT");return s[u]=r[u],s},{}),a=await o.formatMessages(i);n=n.concat(a)}return n}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new Vc(o)}static fromTemplate(e,r){let n=gs.fromTemplate(e,r),o=new uE({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof Vc?s.promptMessages:[LWt(s,r)]),[]),o=e.reduce((a,s)=>s instanceof Vc?Object.assign(a,s.partialVariables):a,Object.create(null)),i=new Set;for(let a of n)if(!(a instanceof Ju))for(let s of a.inputVariables)s in o||i.add(s);return new this({...r,inputVariables:[...i],promptMessages:n,partialVariables:o,templateFormat:r?.templateFormat})}static fromPromptMessages(e){return this.fromMessages(e)}}});var NFe={};nf(NFe,{FewShotChatMessagePromptTemplate:()=>oU,FewShotPromptTemplate:()=>Uj});var Uj,oU,ole=C(()=>{Yq();Bj();$j();nU();Uj=class extends ax{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,e),this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),TA(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new Uj(o)}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),o=await Promise.all(n.map(a=>this.examplePrompt.format(a))),i=[this.prefix,...o,this.suffix].join(this.exampleSeparator);return Xm(i,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(this.outputParser!==void 0)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(e){let{example_prompt:r}=e;if(!r)throw new Error("Missing example prompt");let n=await gs.deserialize(r),o;if(Array.isArray(e.examples))o=e.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new Uj({inputVariables:e.input_variables,examplePrompt:n,examples:o,exampleSeparator:e.example_separator,prefix:e.prefix,suffix:e.suffix,templateFormat:e.template_format})}},oU=class extends tU{_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.examples=e.examples,this.examplePrompt=e.examplePrompt,this.exampleSeparator=e.exampleSeparator??`
`,this.exampleSelector=e.exampleSelector,this.prefix=e.prefix??"",this.suffix=e.suffix??"",this.templateFormat=e.templateFormat??"f-string",this.validateTemplate=e.validateTemplate??!0,this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),TA(this.prefix+this.suffix,this.templateFormat,r)}}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r);n=n.map(i=>{let a={};return this.examplePrompt.inputVariables.forEach(s=>{a[s]=i[s]}),a});let o=[];for(let i of n){let a=await this.examplePrompt.formatMessages(i);o.push(...a)}return o}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),i=(await Promise.all(n.map(s=>this.examplePrompt.formatMessages(s)))).flat().map(s=>s.content),a=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return Xm(a,this.templateFormat,r)}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new oU(o)}}});var Ay,Lj=C(()=>{hf();Ay=class extends nn{get lc_attributes(){return{partialVariables:void 0}}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts",this._getPromptType()]}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"partialVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{inputVariables:r}=e;if(r.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){let r=this.partialVariables??{},n={};for(let[i,a]of Object.entries(r))typeof a=="string"?n[i]=a:n[i]=await a();return{...n,...e}}async invoke(e,r){let n={...this.metadata,...r?.metadata},o=[...this.tags??[],...r?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),e,{...r,tags:o,metadata:n,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(e){switch(e._type){case"prompt":{let{PromptTemplate:r}=await Promise.resolve().then(()=>($j(),Que));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>($j(),Que));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(ole(),NFe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var LFe=C(()=>{Lj();nU()});var FFe=C(()=>{});var kFe=C(()=>{nU()});var BFe=C(()=>{Lj();nU();ole();LFe();$j();FFe();Yq();Bj();ele();kFe()});var MA=C(()=>{BFe()});var sx=C(()=>{zue()});var nke=b(on=>{"use strict";var aU=Symbol.for("react.element"),VWt=Symbol.for("react.portal"),WWt=Symbol.for("react.fragment"),JWt=Symbol.for("react.strict_mode"),GWt=Symbol.for("react.profiler"),KWt=Symbol.for("react.provider"),YWt=Symbol.for("react.context"),XWt=Symbol.for("react.forward_ref"),ZWt=Symbol.for("react.suspense"),QWt=Symbol.for("react.memo"),eJt=Symbol.for("react.lazy"),JFe=Symbol.iterator;function tJt(t){return t===null||typeof t!="object"?null:(t=JFe&&t[JFe]||t["@@iterator"],typeof t=="function"?t:null)}var YFe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},XFe=Object.assign,ZFe={};function Hj(t,e,r){this.props=t,this.context=e,this.refs=ZFe,this.updater=r||YFe}Hj.prototype.isReactComponent={};Hj.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Hj.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function QFe(){}QFe.prototype=Hj.prototype;function fle(t,e,r){this.props=t,this.context=e,this.refs=ZFe,this.updater=r||YFe}var ple=fle.prototype=new QFe;ple.constructor=fle;XFe(ple,Hj.prototype);ple.isPureReactComponent=!0;var GFe=Array.isArray,eke=Object.prototype.hasOwnProperty,hle={current:null},tke={key:!0,ref:!0,__self:!0,__source:!0};function rke(t,e,r){var n,o={},i=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(i=""+e.key),e)eke.call(e,n)&&!tke.hasOwnProperty(n)&&(o[n]=e[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)o[n]===void 0&&(o[n]=s[n]);return{$$typeof:aU,type:t,key:i,ref:a,props:o,_owner:hle.current}}function rJt(t,e){return{$$typeof:aU,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function mle(t){return typeof t=="object"&&t!==null&&t.$$typeof===aU}function nJt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var KFe=/\/+/g;function dle(t,e){return typeof t=="object"&&t!==null&&t.key!=null?nJt(""+t.key):e.toString(36)}function q5(t,e,r,n,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case aU:case VWt:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+dle(a,0):n,GFe(o)?(r="",t!=null&&(r=t.replace(KFe,"$&/")+"/"),q5(o,e,r,"",function(l){return l})):o!=null&&(mle(o)&&(o=rJt(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(KFe,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",GFe(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+dle(i,s);a+=q5(i,e,r,u,o)}else if(u=tJt(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+dle(i,s++),a+=q5(i,e,r,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function $5(t,e,r){if(t==null)return t;var n=[],o=0;return q5(t,n,"","",function(i){return e.call(r,i,o++)}),n}function oJt(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var jd={current:null},U5={transition:null},iJt={ReactCurrentDispatcher:jd,ReactCurrentBatchConfig:U5,ReactCurrentOwner:hle};on.Children={map:$5,forEach:function(t,e,r){$5(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return $5(t,function(){e++}),e},toArray:function(t){return $5(t,function(e){return e})||[]},only:function(t){if(!mle(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};on.Component=Hj;on.Fragment=WWt;on.Profiler=GWt;on.PureComponent=fle;on.StrictMode=JWt;on.Suspense=ZWt;on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=iJt;on.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=XFe({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=hle.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)eke.call(e,u)&&!tke.hasOwnProperty(u)&&(n[u]=e[u]===void 0&&s!==void 0?s[u]:e[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){s=Array(u);for(var l=0;l<u;l++)s[l]=arguments[l+2];n.children=s}return{$$typeof:aU,type:t.type,key:o,ref:i,props:n,_owner:a}};on.createContext=function(t){return t={$$typeof:YWt,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:KWt,_context:t},t.Consumer=t};on.createElement=rke;on.createFactory=function(t){var e=rke.bind(null,t);return e.type=t,e};on.createRef=function(){return{current:null}};on.forwardRef=function(t){return{$$typeof:XWt,render:t}};on.isValidElement=mle;on.lazy=function(t){return{$$typeof:eJt,_payload:{_status:-1,_result:t},_init:oJt}};on.memo=function(t,e){return{$$typeof:QWt,type:t,compare:e===void 0?null:e}};on.startTransition=function(t){var e=U5.transition;U5.transition={};try{t()}finally{U5.transition=e}};on.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};on.useCallback=function(t,e){return jd.current.useCallback(t,e)};on.useContext=function(t){return jd.current.useContext(t)};on.useDebugValue=function(){};on.useDeferredValue=function(t){return jd.current.useDeferredValue(t)};on.useEffect=function(t,e){return jd.current.useEffect(t,e)};on.useId=function(){return jd.current.useId()};on.useImperativeHandle=function(t,e,r){return jd.current.useImperativeHandle(t,e,r)};on.useInsertionEffect=function(t,e){return jd.current.useInsertionEffect(t,e)};on.useLayoutEffect=function(t,e){return jd.current.useLayoutEffect(t,e)};on.useMemo=function(t,e){return jd.current.useMemo(t,e)};on.useReducer=function(t,e,r){return jd.current.useReducer(t,e,r)};on.useRef=function(t){return jd.current.useRef(t)};on.useState=function(t){return jd.current.useState(t)};on.useSyncExternalStore=function(t,e,r){return jd.current.useSyncExternalStore(t,e,r)};on.useTransition=function(){return jd.current.useTransition()};on.version="18.2.0"});var Z=b((AOn,oke)=>{"use strict";oke.exports=nke()});var dke=b((wle,Vj)=>{(function(t,e){typeof wle=="object"&&typeof Vj<"u"?Vj.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(wle,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(y){t=y}function n(y){return y instanceof Array||Object.prototype.toString.call(y)==="[object Array]"}function o(y){return y!=null&&Object.prototype.toString.call(y)==="[object Object]"}function i(y,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=[],A,D=y.length;for(A=0;A<D;++A)P.push(w(y[A],A));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,A){return o1e(y,w,P,A,!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,A;for(A=0;A<P;A++)if(A in w&&y.call(this,w[A],A,w))return!0;return!1};function v(y){if(y._isValid==null){var w=h(y),P=m.call(w.parsedDateParts,function(D){return D!=null}),A=!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&&(A=A&&w.charsLeftOver===0&&w.unusedTokens.length===0&&w.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(y))y._isValid=A;else return A}return y._isValid}function g(y){var w=f(NaN);return y!=null?d(h(w),y):h(w).userInvalidated=!0,w}var _=e.momentProperties=[],S=!1;function x(y,w){var P,A,D,z=_.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),z>0)for(P=0;P<z;P++)A=_[P],D=w[A],s(D)||(y[A]=D);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,e.updateOffset(this),S=!1)}function T(y){return y instanceof O||y!=null&&y._isAMomentObject!=null}function E(y){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+y)}function M(y,w){var P=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,y),P){var A=[],D,z,se,At=arguments.length;for(z=0;z<At;z++){if(D="",typeof arguments[z]=="object"){D+=`
[`+z+"] ";for(se in arguments[0])i(arguments[0],se)&&(D+=se+": "+arguments[0][se]+", ");D=D.slice(0,-2)}else D=arguments[z];A.push(D)}E(y+`
Arguments: `+Array.prototype.slice.call(A).join("")+`
`+new Error().stack),P=!1}return w.apply(this,arguments)},w)}var R={};function N(y,w){e.deprecationHandler!=null&&e.deprecationHandler(y,w),R[y]||(E(w),R[y]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function j(y){return typeof Function<"u"&&y instanceof Function||Object.prototype.toString.call(y)==="[object Function]"}function k(y){var w,P;for(P in y)i(y,P)&&(w=y[P],j(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 F(y,w){var P=d({},y),A;for(A in w)i(w,A)&&(o(y[A])&&o(w[A])?(P[A]={},d(P[A],y[A]),d(P[A],w[A])):w[A]!=null?P[A]=w[A]:delete P[A]);for(A in y)i(y,A)&&!i(w,A)&&o(y[A])&&(P[A]=d({},P[A]));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 A=this._calendar[y]||this._calendar.sameElse;return j(A)?A.call(w,P):A}function V(y,w,P){var A=""+Math.abs(y),D=w-A.length,z=y>=0;return(z?P?"+":"":"-")+Math.pow(10,Math.max(0,D)).toString().substr(1)+A}var I=/(\[[^\[]*\])|(\\)?([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,H=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,W={},J={};function re(y,w,P,A){var D=A;typeof A=="string"&&(D=function(){return this[A]()}),y&&(J[y]=D),w&&(J[w[0]]=function(){return V(D.apply(this,arguments),w[1],w[2])}),P&&(J[P]=function(){return this.localeData().ordinal(D.apply(this,arguments),y)})}function Ae(y){return y.match(/\[[\s\S]/)?y.replace(/^\[|\]$/g,""):y.replace(/\\/g,"")}function Y(y){var w=y.match(I),P,A;for(P=0,A=w.length;P<A;P++)J[w[P]]?w[P]=J[w[P]]:w[P]=Ae(w[P]);return function(D){var z="",se;for(se=0;se<A;se++)z+=j(w[se])?w[se].call(D,y):w[se];return z}}function Q(y,w){return y.isValid()?(w=le(w,y.localeData()),W[w]=W[w]||Y(w),W[w](y)):y.localeData().invalidDate()}function le(y,w){var P=5;function A(D){return w.longDateFormat(D)||D}for(H.lastIndex=0;P>=0&&H.test(y);)y=y.replace(H,A),H.lastIndex=0,P-=1;return y}var Re={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 gt(y){var w=this._longDateFormat[y],P=this._longDateFormat[y.toUpperCase()];return w||!P?w:(this._longDateFormat[y]=P.match(I).map(function(A){return A==="MMMM"||A==="MM"||A==="DD"||A==="dddd"?A.slice(1):A}).join(""),this._longDateFormat[y])}var Se="Invalid date";function ae(){return this._invalidDate}var ee="%d",ye=/\d{1,2}/;function Ue(y){return this._ordinal.replace("%d",y)}var ft={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,A){var D=this._relativeTime[P];return j(D)?D(y,w,P,A):D.replace(/%d/i,y)}function cr(y,w){var P=this._relativeTime[y>0?"future":"past"];return j(P)?P(w):P.replace(/%s/i,w)}var Yr={};function dr(y,w){var P=y.toLowerCase();Yr[P]=Yr[P+"s"]=Yr[w]=y}function qt(y){return typeof y=="string"?Yr[y]||Yr[y.toLowerCase()]:void 0}function Uo(y){var w={},P,A;for(A in y)i(y,A)&&(P=qt(A),P&&(w[P]=y[A]));return w}var ra={};function Fo(y,w){ra[y]=w}function Ie(y){var w=[],P;for(P in y)i(y,P)&&w.push({unit:P,priority:ra[P]});return w.sort(function(A,D){return A.priority-D.priority}),w}function Xe(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 Ze(y){var w=+y,P=0;return w!==0&&isFinite(w)&&(P=fr(w)),P}function $n(y,w){return function(P){return P!=null?(hl(this,y,P),e.updateOffset(this,w),this):na(this,y)}}function na(y,w){return y.isValid()?y._d["get"+(y._isUTC?"UTC":"")+w]():NaN}function hl(y,w,P){y.isValid()&&!isNaN(P)&&(w==="FullYear"&&Xe(y.year())&&y.month()===1&&y.date()===29?(P=Ze(P),y._d["set"+(y._isUTC?"UTC":"")+w](P,y.month(),eV(P,y.month()))):y._d["set"+(y._isUTC?"UTC":"")+w](P))}function Fc(y){return y=qt(y),j(this[y])?this[y]():this}function km(y,w){if(typeof y=="object"){y=Uo(y);var P=Ie(y),A,D=P.length;for(A=0;A<D;A++)this[P[A].unit](y[P[A].unit])}else if(y=qt(y),j(this[y]))return this[y](w);return this}var Bm=/\d/,Da=/\d\d/,th=/\d{3}/,ep=/\d{4}/,rh=/[+-]?\d{6}/,gn=/\d\d?/,$O=/\d\d\d\d?/,WM=/\d\d\d\d\d\d?/,qO=/\d{1,3}/,ja=/\d{1,4}/,hs=/[+-]?\d{1,6}/,oa=/\d+/,wd=/[+-]?\d+/,kc=/Z|[+-]\d\d:?\d\d/gi,Ya=/Z|[+-]\d\d(?::?\d\d)?/gi,rf=/[+-]?\d+(\.\d{1,3})?/,Sd=/[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,rn;rn={};function je(y,w,P){rn[y]=j(w)?w:function(A,D){return A&&P?P:w}}function xd(y,w){return i(rn,y)?rn[y](w._strict,w._locale):new RegExp(tp(y))}function tp(y){return Hu(y.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(w,P,A,D,z){return P||A||D||z}))}function Hu(y){return y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var NS={};function Xr(y,w){var P,A=w,D;for(typeof y=="string"&&(y=[y]),u(w)&&(A=function(z,se){se[w]=Ze(z)}),D=y.length,P=0;P<D;P++)NS[y[P]]=A}function $m(y,w){Xr(y,function(P,A,D,z){D._w=D._w||{},w(P,D._w,D,z)})}function sq(y,w,P){w!=null&&i(NS,y)&&NS[y](w,P._a,P,y)}var Bc=0,LS=1,yy=2,Vu=3,qm=4,FS=5,JM=6,pzt=7,hzt=8;function mzt(y,w){return(y%w+w)%w}var Xa;Array.prototype.indexOf?Xa=Array.prototype.indexOf:Xa=function(y){var w;for(w=0;w<this.length;++w)if(this[w]===y)return w;return-1};function eV(y,w){if(isNaN(y)||isNaN(w))return NaN;var P=mzt(w,12);return y+=(w-P)/12,P===1?Xe(y)?29:28:31-P%7%2}re("M",["MM",2],"Mo",function(){return this.month()+1}),re("MMM",0,0,function(y){return this.localeData().monthsShort(this,y)}),re("MMMM",0,0,function(y){return this.localeData().months(this,y)}),dr("month","M"),Fo("month",8),je("M",gn),je("MM",gn,Da),je("MMM",function(y,w){return w.monthsShortRegex(y)}),je("MMMM",function(y,w){return w.monthsRegex(y)}),Xr(["M","MM"],function(y,w){w[LS]=Ze(y)-1}),Xr(["MMM","MMMM"],function(y,w,P,A){var D=P._locale.monthsParse(y,A,P._strict);D!=null?w[LS]=D:h(P).invalidMonth=y});var gzt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),zIe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),HIe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,yzt=Sd,bzt=Sd;function _zt(y,w){return y?n(this._months)?this._months[y.month()]:this._months[(this._months.isFormat||HIe).test(w)?"format":"standalone"][y.month()]:n(this._months)?this._months:this._months.standalone}function vzt(y,w){return y?n(this._monthsShort)?this._monthsShort[y.month()]:this._monthsShort[HIe.test(w)?"format":"standalone"][y.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function wzt(y,w,P){var A,D,z,se=y.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],A=0;A<12;++A)z=f([2e3,A]),this._shortMonthsParse[A]=this.monthsShort(z,"").toLocaleLowerCase(),this._longMonthsParse[A]=this.months(z,"").toLocaleLowerCase();return P?w==="MMM"?(D=Xa.call(this._shortMonthsParse,se),D!==-1?D:null):(D=Xa.call(this._longMonthsParse,se),D!==-1?D:null):w==="MMM"?(D=Xa.call(this._shortMonthsParse,se),D!==-1?D:(D=Xa.call(this._longMonthsParse,se),D!==-1?D:null)):(D=Xa.call(this._longMonthsParse,se),D!==-1?D:(D=Xa.call(this._shortMonthsParse,se),D!==-1?D:null))}function Szt(y,w,P){var A,D,z;if(this._monthsParseExact)return wzt.call(this,y,w,P);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),A=0;A<12;A++){if(D=f([2e3,A]),P&&!this._longMonthsParse[A]&&(this._longMonthsParse[A]=new RegExp("^"+this.months(D,"").replace(".","")+"$","i"),this._shortMonthsParse[A]=new RegExp("^"+this.monthsShort(D,"").replace(".","")+"$","i")),!P&&!this._monthsParse[A]&&(z="^"+this.months(D,"")+"|^"+this.monthsShort(D,""),this._monthsParse[A]=new RegExp(z.replace(".",""),"i")),P&&w==="MMMM"&&this._longMonthsParse[A].test(y))return A;if(P&&w==="MMM"&&this._shortMonthsParse[A].test(y))return A;if(!P&&this._monthsParse[A].test(y))return A}}function VIe(y,w){var P;if(!y.isValid())return y;if(typeof w=="string"){if(/^\d+$/.test(w))w=Ze(w);else if(w=y.localeData().monthsParse(w),!u(w))return y}return P=Math.min(y.date(),eV(y.year(),w)),y._d["set"+(y._isUTC?"UTC":"")+"Month"](w,P),y}function WIe(y){return y!=null?(VIe(this,y),e.updateOffset(this,!0),this):na(this,"Month")}function xzt(){return eV(this.year(),this.month())}function Czt(y){return this._monthsParseExact?(i(this,"_monthsRegex")||JIe.call(this),y?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=yzt),this._monthsShortStrictRegex&&y?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ozt(y){return this._monthsParseExact?(i(this,"_monthsRegex")||JIe.call(this),y?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=bzt),this._monthsStrictRegex&&y?this._monthsStrictRegex:this._monthsRegex)}function JIe(){function y(se,At){return At.length-se.length}var w=[],P=[],A=[],D,z;for(D=0;D<12;D++)z=f([2e3,D]),w.push(this.monthsShort(z,"")),P.push(this.months(z,"")),A.push(this.months(z,"")),A.push(this.monthsShort(z,""));for(w.sort(y),P.sort(y),A.sort(y),D=0;D<12;D++)w[D]=Hu(w[D]),P[D]=Hu(P[D]);for(D=0;D<24;D++)A[D]=Hu(A[D]);this._monthsRegex=new RegExp("^("+A.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+P.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+w.join("|")+")","i")}re("Y",0,0,function(){var y=this.year();return y<=9999?V(y,4):"+"+y}),re(0,["YY",2],0,function(){return this.year()%100}),re(0,["YYYY",4],0,"year"),re(0,["YYYYY",5],0,"year"),re(0,["YYYYYY",6,!0],0,"year"),dr("year","y"),Fo("year",1),je("Y",wd),je("YY",gn,Da),je("YYYY",ja,ep),je("YYYYY",hs,rh),je("YYYYYY",hs,rh),Xr(["YYYYY","YYYYYY"],Bc),Xr("YYYY",function(y,w){w[Bc]=y.length===2?e.parseTwoDigitYear(y):Ze(y)}),Xr("YY",function(y,w){w[Bc]=e.parseTwoDigitYear(y)}),Xr("Y",function(y,w){w[Bc]=parseInt(y,10)});function uq(y){return Xe(y)?366:365}e.parseTwoDigitYear=function(y){return Ze(y)+(Ze(y)>68?1900:2e3)};var GIe=$n("FullYear",!0);function Ezt(){return Xe(this.year())}function Pzt(y,w,P,A,D,z,se){var At;return y<100&&y>=0?(At=new Date(y+400,w,P,A,D,z,se),isFinite(At.getFullYear())&&At.setFullYear(y)):At=new Date(y,w,P,A,D,z,se),At}function lq(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 tV(y,w,P){var A=7+w-P,D=(7+lq(y,0,A).getUTCDay()-w)%7;return-D+A-1}function KIe(y,w,P,A,D){var z=(7+P-A)%7,se=tV(y,A,D),At=1+7*(w-1)+z+se,Ir,zo;return At<=0?(Ir=y-1,zo=uq(Ir)+At):At>uq(y)?(Ir=y+1,zo=At-uq(y)):(Ir=y,zo=At),{year:Ir,dayOfYear:zo}}function cq(y,w,P){var A=tV(y.year(),w,P),D=Math.floor((y.dayOfYear()-A-1)/7)+1,z,se;return D<1?(se=y.year()-1,z=D+kS(se,w,P)):D>kS(y.year(),w,P)?(z=D-kS(y.year(),w,P),se=y.year()+1):(se=y.year(),z=D),{week:z,year:se}}function kS(y,w,P){var A=tV(y,w,P),D=tV(y+1,w,P);return(uq(y)-A+D)/7}re("w",["ww",2],"wo","week"),re("W",["WW",2],"Wo","isoWeek"),dr("week","w"),dr("isoWeek","W"),Fo("week",5),Fo("isoWeek",5),je("w",gn),je("ww",gn,Da),je("W",gn),je("WW",gn,Da),$m(["w","ww","W","WW"],function(y,w,P,A){w[A.substr(0,1)]=Ze(y)});function Tzt(y){return cq(y,this._week.dow,this._week.doy).week}var Mzt={dow:0,doy:6};function Azt(){return this._week.dow}function Rzt(){return this._week.doy}function Izt(y){var w=this.localeData().week(this);return y==null?w:this.add((y-w)*7,"d")}function Dzt(y){var w=cq(this,1,4).week;return y==null?w:this.add((y-w)*7,"d")}re("d",0,"do","day"),re("dd",0,0,function(y){return this.localeData().weekdaysMin(this,y)}),re("ddd",0,0,function(y){return this.localeData().weekdaysShort(this,y)}),re("dddd",0,0,function(y){return this.localeData().weekdays(this,y)}),re("e",0,0,"weekday"),re("E",0,0,"isoWeekday"),dr("day","d"),dr("weekday","e"),dr("isoWeekday","E"),Fo("day",11),Fo("weekday",11),Fo("isoWeekday",11),je("d",gn),je("e",gn),je("E",gn),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)}),$m(["dd","ddd","dddd"],function(y,w,P,A){var D=P._locale.weekdaysParse(y,A,P._strict);D!=null?w.d=D:h(P).invalidWeekday=y}),$m(["d","e","E"],function(y,w,P,A){w[A]=Ze(y)});function jzt(y,w){return typeof y!="string"?y:isNaN(y)?(y=w.weekdaysParse(y),typeof y=="number"?y:null):parseInt(y,10)}function Nzt(y,w){return typeof y=="string"?w.weekdaysParse(y)%7||7:isNaN(y)?null:y}function Sae(y,w){return y.slice(w,7).concat(y.slice(0,w))}var Lzt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),YIe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Fzt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),kzt=Sd,Bzt=Sd,$zt=Sd;function qzt(y,w){var P=n(this._weekdays)?this._weekdays:this._weekdays[y&&y!==!0&&this._weekdays.isFormat.test(w)?"format":"standalone"];return y===!0?Sae(P,this._week.dow):y?P[y.day()]:P}function Uzt(y){return y===!0?Sae(this._weekdaysShort,this._week.dow):y?this._weekdaysShort[y.day()]:this._weekdaysShort}function zzt(y){return y===!0?Sae(this._weekdaysMin,this._week.dow):y?this._weekdaysMin[y.day()]:this._weekdaysMin}function Hzt(y,w,P){var A,D,z,se=y.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],A=0;A<7;++A)z=f([2e3,1]).day(A),this._minWeekdaysParse[A]=this.weekdaysMin(z,"").toLocaleLowerCase(),this._shortWeekdaysParse[A]=this.weekdaysShort(z,"").toLocaleLowerCase(),this._weekdaysParse[A]=this.weekdays(z,"").toLocaleLowerCase();return P?w==="dddd"?(D=Xa.call(this._weekdaysParse,se),D!==-1?D:null):w==="ddd"?(D=Xa.call(this._shortWeekdaysParse,se),D!==-1?D:null):(D=Xa.call(this._minWeekdaysParse,se),D!==-1?D:null):w==="dddd"?(D=Xa.call(this._weekdaysParse,se),D!==-1||(D=Xa.call(this._shortWeekdaysParse,se),D!==-1)?D:(D=Xa.call(this._minWeekdaysParse,se),D!==-1?D:null)):w==="ddd"?(D=Xa.call(this._shortWeekdaysParse,se),D!==-1||(D=Xa.call(this._weekdaysParse,se),D!==-1)?D:(D=Xa.call(this._minWeekdaysParse,se),D!==-1?D:null)):(D=Xa.call(this._minWeekdaysParse,se),D!==-1||(D=Xa.call(this._weekdaysParse,se),D!==-1)?D:(D=Xa.call(this._shortWeekdaysParse,se),D!==-1?D:null))}function Vzt(y,w,P){var A,D,z;if(this._weekdaysParseExact)return Hzt.call(this,y,w,P);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),A=0;A<7;A++){if(D=f([2e3,1]).day(A),P&&!this._fullWeekdaysParse[A]&&(this._fullWeekdaysParse[A]=new RegExp("^"+this.weekdays(D,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[A]=new RegExp("^"+this.weekdaysShort(D,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[A]=new RegExp("^"+this.weekdaysMin(D,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[A]||(z="^"+this.weekdays(D,"")+"|^"+this.weekdaysShort(D,"")+"|^"+this.weekdaysMin(D,""),this._weekdaysParse[A]=new RegExp(z.replace(".",""),"i")),P&&w==="dddd"&&this._fullWeekdaysParse[A].test(y))return A;if(P&&w==="ddd"&&this._shortWeekdaysParse[A].test(y))return A;if(P&&w==="dd"&&this._minWeekdaysParse[A].test(y))return A;if(!P&&this._weekdaysParse[A].test(y))return A}}function Wzt(y){if(!this.isValid())return y!=null?this:NaN;var w=this._isUTC?this._d.getUTCDay():this._d.getDay();return y!=null?(y=jzt(y,this.localeData()),this.add(y-w,"d")):w}function Jzt(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 Gzt(y){if(!this.isValid())return y!=null?this:NaN;if(y!=null){var w=Nzt(y,this.localeData());return this.day(this.day()%7?w:w-7)}else return this.day()||7}function Kzt(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||xae.call(this),y?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=kzt),this._weekdaysStrictRegex&&y?this._weekdaysStrictRegex:this._weekdaysRegex)}function Yzt(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||xae.call(this),y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Bzt),this._weekdaysShortStrictRegex&&y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Xzt(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||xae.call(this),y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=$zt),this._weekdaysMinStrictRegex&&y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function xae(){function y(Cd,zS){return zS.length-Cd.length}var w=[],P=[],A=[],D=[],z,se,At,Ir,zo;for(z=0;z<7;z++)se=f([2e3,1]).day(z),At=Hu(this.weekdaysMin(se,"")),Ir=Hu(this.weekdaysShort(se,"")),zo=Hu(this.weekdays(se,"")),w.push(At),P.push(Ir),A.push(zo),D.push(At),D.push(Ir),D.push(zo);w.sort(y),P.sort(y),A.sort(y),D.sort(y),this._weekdaysRegex=new RegExp("^("+D.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+A.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+P.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+w.join("|")+")","i")}function Cae(){return this.hours()%12||12}function Zzt(){return this.hours()||24}re("H",["HH",2],0,"hour"),re("h",["hh",2],0,Cae),re("k",["kk",2],0,Zzt),re("hmm",0,0,function(){return""+Cae.apply(this)+V(this.minutes(),2)}),re("hmmss",0,0,function(){return""+Cae.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),re("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),re("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)});function XIe(y,w){re(y,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),w)})}XIe("a",!0),XIe("A",!1),dr("hour","h"),Fo("hour",13);function ZIe(y,w){return w._meridiemParse}je("a",ZIe),je("A",ZIe),je("H",gn),je("h",gn),je("k",gn),je("HH",gn,Da),je("hh",gn,Da),je("kk",gn,Da),je("hmm",$O),je("hmmss",WM),je("Hmm",$O),je("Hmmss",WM),Xr(["H","HH"],Vu),Xr(["k","kk"],function(y,w,P){var A=Ze(y);w[Vu]=A===24?0:A}),Xr(["a","A"],function(y,w,P){P._isPm=P._locale.isPM(y),P._meridiem=y}),Xr(["h","hh"],function(y,w,P){w[Vu]=Ze(y),h(P).bigHour=!0}),Xr("hmm",function(y,w,P){var A=y.length-2;w[Vu]=Ze(y.substr(0,A)),w[qm]=Ze(y.substr(A)),h(P).bigHour=!0}),Xr("hmmss",function(y,w,P){var A=y.length-4,D=y.length-2;w[Vu]=Ze(y.substr(0,A)),w[qm]=Ze(y.substr(A,2)),w[FS]=Ze(y.substr(D)),h(P).bigHour=!0}),Xr("Hmm",function(y,w,P){var A=y.length-2;w[Vu]=Ze(y.substr(0,A)),w[qm]=Ze(y.substr(A))}),Xr("Hmmss",function(y,w,P){var A=y.length-4,D=y.length-2;w[Vu]=Ze(y.substr(0,A)),w[qm]=Ze(y.substr(A,2)),w[FS]=Ze(y.substr(D))});function Qzt(y){return(y+"").toLowerCase().charAt(0)==="p"}var e2t=/[ap]\.?m?\.?/i,t2t=$n("Hours",!0);function r2t(y,w,P){return y>11?P?"pm":"PM":P?"am":"AM"}var QIe={calendar:U,longDateFormat:Re,invalidDate:Se,ordinal:ee,dayOfMonthOrdinalParse:ye,relativeTime:ft,months:gzt,monthsShort:zIe,week:Mzt,weekdays:Lzt,weekdaysMin:Fzt,weekdaysShort:YIe,meridiemParse:e2t},ki={},dq={},fq;function n2t(y,w){var P,A=Math.min(y.length,w.length);for(P=0;P<A;P+=1)if(y[P]!==w[P])return P;return A}function e1e(y){return y&&y.toLowerCase().replace("_","-")}function o2t(y){for(var w=0,P,A,D,z;w<y.length;){for(z=e1e(y[w]).split("-"),P=z.length,A=e1e(y[w+1]),A=A?A.split("-"):null;P>0;){if(D=rV(z.slice(0,P).join("-")),D)return D;if(A&&A.length>=P&&n2t(z,A)>=P-1)break;P--}w++}return fq}function i2t(y){return y.match("^[^/\\\\]*$")!=null}function rV(y){var w=null,P;if(ki[y]===void 0&&typeof Vj<"u"&&Vj&&Vj.exports&&i2t(y))try{w=fq._abbr,P=require,P("./locale/"+y),UO(w)}catch{ki[y]=null}return ki[y]}function UO(y,w){var P;return y&&(s(w)?P=BS(y):P=Oae(y,w),P?fq=P:typeof console<"u"&&console.warn&&console.warn("Locale "+y+" not found. Did you forget to load it?")),fq._abbr}function Oae(y,w){if(w!==null){var P,A=QIe;if(w.abbr=y,ki[y]!=null)N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),A=ki[y]._config;else if(w.parentLocale!=null)if(ki[w.parentLocale]!=null)A=ki[w.parentLocale]._config;else if(P=rV(w.parentLocale),P!=null)A=P._config;else return dq[w.parentLocale]||(dq[w.parentLocale]=[]),dq[w.parentLocale].push({name:y,config:w}),null;return ki[y]=new L(F(A,w)),dq[y]&&dq[y].forEach(function(D){Oae(D.name,D.config)}),UO(y),ki[y]}else return delete ki[y],null}function a2t(y,w){if(w!=null){var P,A,D=QIe;ki[y]!=null&&ki[y].parentLocale!=null?ki[y].set(F(ki[y]._config,w)):(A=rV(y),A!=null&&(D=A._config),w=F(D,w),A==null&&(w.abbr=y),P=new L(w),P.parentLocale=ki[y],ki[y]=P),UO(y)}else ki[y]!=null&&(ki[y].parentLocale!=null?(ki[y]=ki[y].parentLocale,y===UO()&&UO(y)):ki[y]!=null&&delete ki[y]);return ki[y]}function BS(y){var w;if(y&&y._locale&&y._locale._abbr&&(y=y._locale._abbr),!y)return fq;if(!n(y)){if(w=rV(y),w)return w;y=[y]}return o2t(y)}function s2t(){return q(ki)}function Eae(y){var w,P=y._a;return P&&h(y).overflow===-2&&(w=P[LS]<0||P[LS]>11?LS:P[yy]<1||P[yy]>eV(P[Bc],P[LS])?yy:P[Vu]<0||P[Vu]>24||P[Vu]===24&&(P[qm]!==0||P[FS]!==0||P[JM]!==0)?Vu:P[qm]<0||P[qm]>59?qm:P[FS]<0||P[FS]>59?FS:P[JM]<0||P[JM]>999?JM:-1,h(y)._overflowDayOfYear&&(w<Bc||w>yy)&&(w=yy),h(y)._overflowWeeks&&w===-1&&(w=pzt),h(y)._overflowWeekday&&w===-1&&(w=hzt),h(y).overflow=w),y}var u2t=/^\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)?)?$/,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)?)?$/,c2t=/Z|[+-]\d\d(?::?\d\d)?/,nV=[["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]],Pae=[["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/]],d2t=/^\/?Date\((-?\d+)/i,f2t=/^(?:(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}))$/,p2t={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 t1e(y){var w,P,A=y._i,D=u2t.exec(A)||l2t.exec(A),z,se,At,Ir,zo=nV.length,Cd=Pae.length;if(D){for(h(y).iso=!0,w=0,P=zo;w<P;w++)if(nV[w][1].exec(D[1])){se=nV[w][0],z=nV[w][2]!==!1;break}if(se==null){y._isValid=!1;return}if(D[3]){for(w=0,P=Cd;w<P;w++)if(Pae[w][1].exec(D[3])){At=(D[2]||" ")+Pae[w][0];break}if(At==null){y._isValid=!1;return}}if(!z&&At!=null){y._isValid=!1;return}if(D[4])if(c2t.exec(D[4]))Ir="Z";else{y._isValid=!1;return}y._f=se+(At||"")+(Ir||""),Mae(y)}else y._isValid=!1}function h2t(y,w,P,A,D,z){var se=[m2t(y),zIe.indexOf(w),parseInt(P,10),parseInt(A,10),parseInt(D,10)];return z&&se.push(parseInt(z,10)),se}function m2t(y){var w=parseInt(y,10);return w<=49?2e3+w:w<=999?1900+w:w}function g2t(y){return y.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function y2t(y,w,P){if(y){var A=YIe.indexOf(y),D=new Date(w[0],w[1],w[2]).getDay();if(A!==D)return h(P).weekdayMismatch=!0,P._isValid=!1,!1}return!0}function b2t(y,w,P){if(y)return p2t[y];if(w)return 0;var A=parseInt(P,10),D=A%100,z=(A-D)/100;return z*60+D}function r1e(y){var w=f2t.exec(g2t(y._i)),P;if(w){if(P=h2t(w[4],w[3],w[2],w[5],w[6],w[7]),!y2t(w[1],P,y))return;y._a=P,y._tzm=b2t(w[8],w[9],w[10]),y._d=lq.apply(null,y._a),y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),h(y).rfc2822=!0}else y._isValid=!1}function _2t(y){var w=d2t.exec(y._i);if(w!==null){y._d=new Date(+w[1]);return}if(t1e(y),y._isValid===!1)delete y._isValid;else return;if(r1e(y),y._isValid===!1)delete y._isValid;else return;y._strict?y._isValid=!1:e.createFromInputFallback(y)}e.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 nj(y,w,P){return y??w??P}function v2t(y){var w=new Date(e.now());return y._useUTC?[w.getUTCFullYear(),w.getUTCMonth(),w.getUTCDate()]:[w.getFullYear(),w.getMonth(),w.getDate()]}function Tae(y){var w,P,A=[],D,z,se;if(!y._d){for(D=v2t(y),y._w&&y._a[yy]==null&&y._a[LS]==null&&w2t(y),y._dayOfYear!=null&&(se=nj(y._a[Bc],D[Bc]),(y._dayOfYear>uq(se)||y._dayOfYear===0)&&(h(y)._overflowDayOfYear=!0),P=lq(se,0,y._dayOfYear),y._a[LS]=P.getUTCMonth(),y._a[yy]=P.getUTCDate()),w=0;w<3&&y._a[w]==null;++w)y._a[w]=A[w]=D[w];for(;w<7;w++)y._a[w]=A[w]=y._a[w]==null?w===2?1:0:y._a[w];y._a[Vu]===24&&y._a[qm]===0&&y._a[FS]===0&&y._a[JM]===0&&(y._nextDay=!0,y._a[Vu]=0),y._d=(y._useUTC?lq:Pzt).apply(null,A),z=y._useUTC?y._d.getUTCDay():y._d.getDay(),y._tzm!=null&&y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),y._nextDay&&(y._a[Vu]=24),y._w&&typeof y._w.d<"u"&&y._w.d!==z&&(h(y).weekdayMismatch=!0)}}function w2t(y){var w,P,A,D,z,se,At,Ir,zo;w=y._w,w.GG!=null||w.W!=null||w.E!=null?(z=1,se=4,P=nj(w.GG,y._a[Bc],cq(gi(),1,4).year),A=nj(w.W,1),D=nj(w.E,1),(D<1||D>7)&&(Ir=!0)):(z=y._locale._week.dow,se=y._locale._week.doy,zo=cq(gi(),z,se),P=nj(w.gg,y._a[Bc],zo.year),A=nj(w.w,zo.week),w.d!=null?(D=w.d,(D<0||D>6)&&(Ir=!0)):w.e!=null?(D=w.e+z,(w.e<0||w.e>6)&&(Ir=!0)):D=z),A<1||A>kS(P,z,se)?h(y)._overflowWeeks=!0:Ir!=null?h(y)._overflowWeekday=!0:(At=KIe(P,A,D,z,se),y._a[Bc]=At.year,y._dayOfYear=At.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Mae(y){if(y._f===e.ISO_8601){t1e(y);return}if(y._f===e.RFC_2822){r1e(y);return}y._a=[],h(y).empty=!0;var w=""+y._i,P,A,D,z,se,At=w.length,Ir=0,zo,Cd;for(D=le(y._f,y._locale).match(I)||[],Cd=D.length,P=0;P<Cd;P++)z=D[P],A=(w.match(xd(z,y))||[])[0],A&&(se=w.substr(0,w.indexOf(A)),se.length>0&&h(y).unusedInput.push(se),w=w.slice(w.indexOf(A)+A.length),Ir+=A.length),J[z]?(A?h(y).empty=!1:h(y).unusedTokens.push(z),sq(z,A,y)):y._strict&&!A&&h(y).unusedTokens.push(z);h(y).charsLeftOver=At-Ir,w.length>0&&h(y).unusedInput.push(w),y._a[Vu]<=12&&h(y).bigHour===!0&&y._a[Vu]>0&&(h(y).bigHour=void 0),h(y).parsedDateParts=y._a.slice(0),h(y).meridiem=y._meridiem,y._a[Vu]=S2t(y._locale,y._a[Vu],y._meridiem),zo=h(y).era,zo!==null&&(y._a[Bc]=y._locale.erasConvertYear(zo,y._a[Bc])),Tae(y),Eae(y)}function S2t(y,w,P){var A;return P==null?w:y.meridiemHour!=null?y.meridiemHour(w,P):(y.isPM!=null&&(A=y.isPM(P),A&&w<12&&(w+=12),!A&&w===12&&(w=0)),w)}function x2t(y){var w,P,A,D,z,se,At=!1,Ir=y._f.length;if(Ir===0){h(y).invalidFormat=!0,y._d=new Date(NaN);return}for(D=0;D<Ir;D++)z=0,se=!1,w=x({},y),y._useUTC!=null&&(w._useUTC=y._useUTC),w._f=y._f[D],Mae(w),v(w)&&(se=!0),z+=h(w).charsLeftOver,z+=h(w).unusedTokens.length*10,h(w).score=z,At?z<A&&(A=z,P=w):(A==null||z<A||se)&&(A=z,P=w,se&&(At=!0));d(y,P||w)}function C2t(y){if(!y._d){var w=Uo(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(A){return A&&parseInt(A,10)}),Tae(y)}}function O2t(y){var w=new O(Eae(n1e(y)));return w._nextDay&&(w.add(1,"d"),w._nextDay=void 0),w}function n1e(y){var w=y._i,P=y._f;return y._locale=y._locale||BS(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(Eae(w)):(l(w)?y._d=w:n(P)?x2t(y):P?Mae(y):E2t(y),v(y)||(y._d=null),y))}function E2t(y){var w=y._i;s(w)?y._d=new Date(e.now()):l(w)?y._d=new Date(w.valueOf()):typeof w=="string"?_2t(y):n(w)?(y._a=c(w.slice(0),function(P){return parseInt(P,10)}),Tae(y)):o(w)?C2t(y):u(w)?y._d=new Date(w):e.createFromInputFallback(y)}function o1e(y,w,P,A,D){var z={};return(w===!0||w===!1)&&(A=w,w=void 0),(P===!0||P===!1)&&(A=P,P=void 0),(o(y)&&a(y)||n(y)&&y.length===0)&&(y=void 0),z._isAMomentObject=!0,z._useUTC=z._isUTC=D,z._l=P,z._i=y,z._f=w,z._strict=A,O2t(z)}function gi(y,w,P,A){return o1e(y,w,P,A,!1)}var P2t=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()}),T2t=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,A;if(w.length===1&&n(w[0])&&(w=w[0]),!w.length)return gi();for(P=w[0],A=1;A<w.length;++A)(!w[A].isValid()||w[A][y](P))&&(P=w[A]);return P}function M2t(){var y=[].slice.call(arguments,0);return i1e("isBefore",y)}function A2t(){var y=[].slice.call(arguments,0);return i1e("isAfter",y)}var R2t=function(){return Date.now?Date.now():+new Date},pq=["year","quarter","month","week","day","hour","minute","second","millisecond"];function I2t(y){var w,P=!1,A,D=pq.length;for(w in y)if(i(y,w)&&!(Xa.call(pq,w)!==-1&&(y[w]==null||!isNaN(y[w]))))return!1;for(A=0;A<D;++A)if(y[pq[A]]){if(P)return!1;parseFloat(y[pq[A]])!==Ze(y[pq[A]])&&(P=!0)}return!0}function D2t(){return this._isValid}function j2t(){return Um(NaN)}function oV(y){var w=Uo(y),P=w.year||0,A=w.quarter||0,D=w.month||0,z=w.week||w.isoWeek||0,se=w.day||0,At=w.hour||0,Ir=w.minute||0,zo=w.second||0,Cd=w.millisecond||0;this._isValid=I2t(w),this._milliseconds=+Cd+zo*1e3+Ir*6e4+At*1e3*60*60,this._days=+se+z*7,this._months=+D+A*3+P*12,this._data={},this._locale=BS(),this._bubble()}function iV(y){return y instanceof oV}function Aae(y){return y<0?Math.round(-1*y)*-1:Math.round(y)}function N2t(y,w,P){var A=Math.min(y.length,w.length),D=Math.abs(y.length-w.length),z=0,se;for(se=0;se<A;se++)(P&&y[se]!==w[se]||!P&&Ze(y[se])!==Ze(w[se]))&&z++;return z+D}function a1e(y,w){re(y,0,0,function(){var P=this.utcOffset(),A="+";return P<0&&(P=-P,A="-"),A+V(~~(P/60),2)+w+V(~~P%60,2)})}a1e("Z",":"),a1e("ZZ",""),je("Z",Ya),je("ZZ",Ya),Xr(["Z","ZZ"],function(y,w,P){P._useUTC=!0,P._tzm=Rae(Ya,y)});var L2t=/([\+\-]|\d\d)/gi;function Rae(y,w){var P=(w||"").match(y),A,D,z;return P===null?null:(A=P[P.length-1]||[],D=(A+"").match(L2t)||["-",0,0],z=+(D[1]*60)+Ze(D[2]),z===0?0:D[0]==="+"?z:-z)}function Iae(y,w){var P,A;return w._isUTC?(P=w.clone(),A=(T(y)||l(y)?y.valueOf():gi(y).valueOf())-P.valueOf(),P._d.setTime(P._d.valueOf()+A),e.updateOffset(P,!1),P):gi(y).local()}function Dae(y){return-Math.round(y._d.getTimezoneOffset())}e.updateOffset=function(){};function F2t(y,w,P){var A=this._offset||0,D;if(!this.isValid())return y!=null?this:NaN;if(y!=null){if(typeof y=="string"){if(y=Rae(Ya,y),y===null)return this}else Math.abs(y)<16&&!P&&(y=y*60);return!this._isUTC&&w&&(D=Dae(this)),this._offset=y,this._isUTC=!0,D!=null&&this.add(D,"m"),A!==y&&(!w||this._changeInProgress?c1e(this,Um(y-A,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?A:Dae(this)}function k2t(y,w){return y!=null?(typeof y!="string"&&(y=-y),this.utcOffset(y,w),this):-this.utcOffset()}function B2t(y){return this.utcOffset(0,y)}function $2t(y){return this._isUTC&&(this.utcOffset(0,y),this._isUTC=!1,y&&this.subtract(Dae(this),"m")),this}function q2t(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var y=Rae(kc,this._i);y!=null?this.utcOffset(y):this.utcOffset(0,!0)}return this}function U2t(y){return this.isValid()?(y=y?gi(y).utcOffset():0,(this.utcOffset()-y)%60===0):!1}function z2t(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function H2t(){if(!s(this._isDSTShifted))return this._isDSTShifted;var y={},w;return x(y,this),y=n1e(y),y._a?(w=y._isUTC?f(y._a):gi(y._a),this._isDSTShifted=this.isValid()&&N2t(y._a,w.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function V2t(){return this.isValid()?!this._isUTC:!1}function W2t(){return this.isValid()?this._isUTC:!1}function s1e(){return this.isValid()?this._isUTC&&this._offset===0:!1}var J2t=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,G2t=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Um(y,w){var P=y,A=null,D,z,se;return iV(y)?P={ms:y._milliseconds,d:y._days,M:y._months}:u(y)||!isNaN(+y)?(P={},w?P[w]=+y:P.milliseconds=+y):(A=J2t.exec(y))?(D=A[1]==="-"?-1:1,P={y:0,d:Ze(A[yy])*D,h:Ze(A[Vu])*D,m:Ze(A[qm])*D,s:Ze(A[FS])*D,ms:Ze(Aae(A[JM]*1e3))*D}):(A=G2t.exec(y))?(D=A[1]==="-"?-1:1,P={y:GM(A[2],D),M:GM(A[3],D),w:GM(A[4],D),d:GM(A[5],D),h:GM(A[6],D),m:GM(A[7],D),s:GM(A[8],D)}):P==null?P={}:typeof P=="object"&&("from"in P||"to"in P)&&(se=K2t(gi(P.from),gi(P.to)),P={},P.ms=se.milliseconds,P.M=se.months),z=new oV(P),iV(y)&&i(y,"_locale")&&(z._locale=y._locale),iV(y)&&i(y,"_isValid")&&(z._isValid=y._isValid),z}Um.fn=oV.prototype,Um.invalid=j2t;function GM(y,w){var P=y&&parseFloat(y.replace(",","."));return(isNaN(P)?0:P)*w}function u1e(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 K2t(y,w){var P;return y.isValid()&&w.isValid()?(w=Iae(w,y),y.isBefore(w)?P=u1e(y,w):(P=u1e(w,y),P.milliseconds=-P.milliseconds,P.months=-P.months),P):{milliseconds:0,months:0}}function l1e(y,w){return function(P,A){var D,z;return A!==null&&!isNaN(+A)&&(N(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."),z=P,P=A,A=z),D=Um(P,A),c1e(this,D,y),this}}function c1e(y,w,P,A){var D=w._milliseconds,z=Aae(w._days),se=Aae(w._months);y.isValid()&&(A=A??!0,se&&VIe(y,na(y,"Month")+se*P),z&&hl(y,"Date",na(y,"Date")+z*P),D&&y._d.setTime(y._d.valueOf()+D*P),A&&e.updateOffset(y,z||se))}var Y2t=l1e(1,"add"),X2t=l1e(-1,"subtract");function d1e(y){return typeof y=="string"||y instanceof String}function Z2t(y){return T(y)||l(y)||d1e(y)||u(y)||e4t(y)||Q2t(y)||y===null||y===void 0}function Q2t(y){var w=o(y)&&!a(y),P=!1,A=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],D,z,se=A.length;for(D=0;D<se;D+=1)z=A[D],P=P||i(y,z);return w&&P}function e4t(y){var w=n(y),P=!1;return w&&(P=y.filter(function(A){return!u(A)&&d1e(y)}).length===0),w&&P}function t4t(y){var w=o(y)&&!a(y),P=!1,A=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],D,z;for(D=0;D<A.length;D+=1)z=A[D],P=P||i(y,z);return w&&P}function r4t(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 n4t(y,w){arguments.length===1&&(arguments[0]?Z2t(arguments[0])?(y=arguments[0],w=void 0):t4t(arguments[0])&&(w=arguments[0],y=void 0):(y=void 0,w=void 0));var P=y||gi(),A=Iae(P,this).startOf("day"),D=e.calendarFormat(this,A)||"sameElse",z=w&&(j(w[D])?w[D].call(this,P):w[D]);return this.format(z||this.localeData().calendar(D,this,gi(P)))}function o4t(){return new O(this)}function i4t(y,w){var P=T(y)?y:gi(y);return this.isValid()&&P.isValid()?(w=qt(w)||"millisecond",w==="millisecond"?this.valueOf()>P.valueOf():P.valueOf()<this.clone().startOf(w).valueOf()):!1}function a4t(y,w){var P=T(y)?y:gi(y);return this.isValid()&&P.isValid()?(w=qt(w)||"millisecond",w==="millisecond"?this.valueOf()<P.valueOf():this.clone().endOf(w).valueOf()<P.valueOf()):!1}function s4t(y,w,P,A){var D=T(y)?y:gi(y),z=T(w)?w:gi(w);return this.isValid()&&D.isValid()&&z.isValid()?(A=A||"()",(A[0]==="("?this.isAfter(D,P):!this.isBefore(D,P))&&(A[1]===")"?this.isBefore(z,P):!this.isAfter(z,P))):!1}function u4t(y,w){var P=T(y)?y:gi(y),A;return this.isValid()&&P.isValid()?(w=qt(w)||"millisecond",w==="millisecond"?this.valueOf()===P.valueOf():(A=P.valueOf(),this.clone().startOf(w).valueOf()<=A&&A<=this.clone().endOf(w).valueOf())):!1}function l4t(y,w){return this.isSame(y,w)||this.isAfter(y,w)}function c4t(y,w){return this.isSame(y,w)||this.isBefore(y,w)}function d4t(y,w,P){var A,D,z;if(!this.isValid())return NaN;if(A=Iae(y,this),!A.isValid())return NaN;switch(D=(A.utcOffset()-this.utcOffset())*6e4,w=qt(w),w){case"year":z=aV(this,A)/12;break;case"month":z=aV(this,A);break;case"quarter":z=aV(this,A)/3;break;case"second":z=(this-A)/1e3;break;case"minute":z=(this-A)/6e4;break;case"hour":z=(this-A)/36e5;break;case"day":z=(this-A-D)/864e5;break;case"week":z=(this-A-D)/6048e5;break;default:z=this-A}return P?z:fr(z)}function aV(y,w){if(y.date()<w.date())return-aV(w,y);var P=(w.year()-y.year())*12+(w.month()-y.month()),A=y.clone().add(P,"months"),D,z;return w-A<0?(D=y.clone().add(P-1,"months"),z=(w-A)/(A-D)):(D=y.clone().add(P+1,"months"),z=(w-A)/(D-A)),-(P+z)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function f4t(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function p4t(y){if(!this.isValid())return null;var w=y!==!0,P=w?this.clone().utc():this;return P.year()<0||P.year()>9999?Q(P,w?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):j(Date.prototype.toISOString)?w?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Q(P,"Z")):Q(P,w?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function h4t(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var y="moment",w="",P,A,D,z;return this.isLocal()||(y=this.utcOffset()===0?"moment.utc":"moment.parseZone",w="Z"),P="["+y+'("]',A=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",D="-MM-DD[T]HH:mm:ss.SSS",z=w+'[")]',this.format(P+A+D+z)}function m4t(y){y||(y=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var w=Q(this,y);return this.localeData().postformat(w)}function g4t(y,w){return this.isValid()&&(T(y)&&y.isValid()||gi(y).isValid())?Um({to:this,from:y}).locale(this.locale()).humanize(!w):this.localeData().invalidDate()}function y4t(y){return this.from(gi(),y)}function b4t(y,w){return this.isValid()&&(T(y)&&y.isValid()||gi(y).isValid())?Um({from:this,to:y}).locale(this.locale()).humanize(!w):this.localeData().invalidDate()}function _4t(y){return this.to(gi(),y)}function f1e(y){var w;return y===void 0?this._locale._abbr:(w=BS(y),w!=null&&(this._locale=w),this)}var p1e=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 h1e(){return this._locale}var sV=1e3,oj=60*sV,uV=60*oj,m1e=(365*400+97)*24*uV;function ij(y,w){return(y%w+w)%w}function g1e(y,w,P){return y<100&&y>=0?new Date(y+400,w,P)-m1e:new Date(y,w,P).valueOf()}function y1e(y,w,P){return y<100&&y>=0?Date.UTC(y+400,w,P)-m1e:Date.UTC(y,w,P)}function v4t(y){var w,P;if(y=qt(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?y1e:g1e,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-=ij(w+(this._isUTC?0:this.utcOffset()*oj),uV);break;case"minute":w=this._d.valueOf(),w-=ij(w,oj);break;case"second":w=this._d.valueOf(),w-=ij(w,sV);break}return this._d.setTime(w),e.updateOffset(this,!0),this}function w4t(y){var w,P;if(y=qt(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(P=this._isUTC?y1e:g1e,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+=uV-ij(w+(this._isUTC?0:this.utcOffset()*oj),uV)-1;break;case"minute":w=this._d.valueOf(),w+=oj-ij(w,oj)-1;break;case"second":w=this._d.valueOf(),w+=sV-ij(w,sV)-1;break}return this._d.setTime(w),e.updateOffset(this,!0),this}function S4t(){return this._d.valueOf()-(this._offset||0)*6e4}function x4t(){return Math.floor(this.valueOf()/1e3)}function C4t(){return new Date(this.valueOf())}function O4t(){var y=this;return[y.year(),y.month(),y.date(),y.hour(),y.minute(),y.second(),y.millisecond()]}function E4t(){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 P4t(){return this.isValid()?this.toISOString():null}function T4t(){return v(this)}function M4t(){return d({},h(this))}function A4t(){return h(this).overflow}function R4t(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}re("N",0,0,"eraAbbr"),re("NN",0,0,"eraAbbr"),re("NNN",0,0,"eraAbbr"),re("NNNN",0,0,"eraName"),re("NNNNN",0,0,"eraNarrow"),re("y",["y",1],"yo","eraYear"),re("y",["yy",2],0,"eraYear"),re("y",["yyy",3],0,"eraYear"),re("y",["yyyy",4],0,"eraYear"),je("N",jae),je("NN",jae),je("NNN",jae),je("NNNN",U4t),je("NNNNN",z4t),Xr(["N","NN","NNN","NNNN","NNNNN"],function(y,w,P,A){var D=P._locale.erasParse(y,A,P._strict);D?h(P).era=D:h(P).invalidEra=y}),je("y",oa),je("yy",oa),je("yyy",oa),je("yyyy",oa),je("yo",H4t),Xr(["y","yy","yyy","yyyy"],Bc),Xr(["yo"],function(y,w,P,A){var D;P._locale._eraYearOrdinalRegex&&(D=y.match(P._locale._eraYearOrdinalRegex)),P._locale.eraYearOrdinalParse?w[Bc]=P._locale.eraYearOrdinalParse(y,D):w[Bc]=parseInt(y,10)});function I4t(y,w){var P,A,D,z=this._eras||BS("en")._eras;for(P=0,A=z.length;P<A;++P){switch(typeof z[P].since){case"string":D=e(z[P].since).startOf("day"),z[P].since=D.valueOf();break}switch(typeof z[P].until){case"undefined":z[P].until=1/0;break;case"string":D=e(z[P].until).startOf("day").valueOf(),z[P].until=D.valueOf();break}}return z}function D4t(y,w,P){var A,D,z=this.eras(),se,At,Ir;for(y=y.toUpperCase(),A=0,D=z.length;A<D;++A)if(se=z[A].name.toUpperCase(),At=z[A].abbr.toUpperCase(),Ir=z[A].narrow.toUpperCase(),P)switch(w){case"N":case"NN":case"NNN":if(At===y)return z[A];break;case"NNNN":if(se===y)return z[A];break;case"NNNNN":if(Ir===y)return z[A];break}else if([se,At,Ir].indexOf(y)>=0)return z[A]}function j4t(y,w){var P=y.since<=y.until?1:-1;return w===void 0?e(y.since).year():e(y.since).year()+(w-y.offset)*P}function N4t(){var y,w,P,A=this.localeData().eras();for(y=0,w=A.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),A[y].since<=P&&P<=A[y].until||A[y].until<=P&&P<=A[y].since)return A[y].name;return""}function L4t(){var y,w,P,A=this.localeData().eras();for(y=0,w=A.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),A[y].since<=P&&P<=A[y].until||A[y].until<=P&&P<=A[y].since)return A[y].narrow;return""}function F4t(){var y,w,P,A=this.localeData().eras();for(y=0,w=A.length;y<w;++y)if(P=this.clone().startOf("day").valueOf(),A[y].since<=P&&P<=A[y].until||A[y].until<=P&&P<=A[y].since)return A[y].abbr;return""}function k4t(){var y,w,P,A,D=this.localeData().eras();for(y=0,w=D.length;y<w;++y)if(P=D[y].since<=D[y].until?1:-1,A=this.clone().startOf("day").valueOf(),D[y].since<=A&&A<=D[y].until||D[y].until<=A&&A<=D[y].since)return(this.year()-e(D[y].since).year())*P+D[y].offset;return this.year()}function B4t(y){return i(this,"_erasNameRegex")||Nae.call(this),y?this._erasNameRegex:this._erasRegex}function $4t(y){return i(this,"_erasAbbrRegex")||Nae.call(this),y?this._erasAbbrRegex:this._erasRegex}function q4t(y){return i(this,"_erasNarrowRegex")||Nae.call(this),y?this._erasNarrowRegex:this._erasRegex}function jae(y,w){return w.erasAbbrRegex(y)}function U4t(y,w){return w.erasNameRegex(y)}function z4t(y,w){return w.erasNarrowRegex(y)}function H4t(y,w){return w._eraYearOrdinalRegex||oa}function Nae(){var y=[],w=[],P=[],A=[],D,z,se=this.eras();for(D=0,z=se.length;D<z;++D)w.push(Hu(se[D].name)),y.push(Hu(se[D].abbr)),P.push(Hu(se[D].narrow)),A.push(Hu(se[D].name)),A.push(Hu(se[D].abbr)),A.push(Hu(se[D].narrow));this._erasRegex=new RegExp("^("+A.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+w.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+y.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+P.join("|")+")","i")}re(0,["gg",2],0,function(){return this.weekYear()%100}),re(0,["GG",2],0,function(){return this.isoWeekYear()%100});function lV(y,w){re(0,[y,y.length],0,w)}lV("gggg","weekYear"),lV("ggggg","weekYear"),lV("GGGG","isoWeekYear"),lV("GGGGG","isoWeekYear"),dr("weekYear","gg"),dr("isoWeekYear","GG"),Fo("weekYear",1),Fo("isoWeekYear",1),je("G",wd),je("g",wd),je("GG",gn,Da),je("gg",gn,Da),je("GGGG",ja,ep),je("gggg",ja,ep),je("GGGGG",hs,rh),je("ggggg",hs,rh),$m(["gggg","ggggg","GGGG","GGGGG"],function(y,w,P,A){w[A.substr(0,2)]=Ze(y)}),$m(["gg","GG"],function(y,w,P,A){w[A]=e.parseTwoDigitYear(y)});function V4t(y){return b1e.call(this,y,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function W4t(y){return b1e.call(this,y,this.isoWeek(),this.isoWeekday(),1,4)}function J4t(){return kS(this.year(),1,4)}function G4t(){return kS(this.isoWeekYear(),1,4)}function K4t(){var y=this.localeData()._week;return kS(this.year(),y.dow,y.doy)}function Y4t(){var y=this.localeData()._week;return kS(this.weekYear(),y.dow,y.doy)}function b1e(y,w,P,A,D){var z;return y==null?cq(this,A,D).year:(z=kS(y,A,D),w>z&&(w=z),X4t.call(this,y,w,P,A,D))}function X4t(y,w,P,A,D){var z=KIe(y,w,P,A,D),se=lq(z.year,0,z.dayOfYear);return this.year(se.getUTCFullYear()),this.month(se.getUTCMonth()),this.date(se.getUTCDate()),this}re("Q",0,"Qo","quarter"),dr("quarter","Q"),Fo("quarter",7),je("Q",Bm),Xr("Q",function(y,w){w[LS]=(Ze(y)-1)*3});function Z4t(y){return y==null?Math.ceil((this.month()+1)/3):this.month((y-1)*3+this.month()%3)}re("D",["DD",2],"Do","date"),dr("date","D"),Fo("date",9),je("D",gn),je("DD",gn,Da),je("Do",function(y,w){return y?w._dayOfMonthOrdinalParse||w._ordinalParse:w._dayOfMonthOrdinalParseLenient}),Xr(["D","DD"],yy),Xr("Do",function(y,w){w[yy]=Ze(y.match(gn)[0])});var _1e=$n("Date",!0);re("DDD",["DDDD",3],"DDDo","dayOfYear"),dr("dayOfYear","DDD"),Fo("dayOfYear",4),je("DDD",qO),je("DDDD",th),Xr(["DDD","DDDD"],function(y,w,P){P._dayOfYear=Ze(y)});function Q4t(y){var w=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return y==null?w:this.add(y-w,"d")}re("m",["mm",2],0,"minute"),dr("minute","m"),Fo("minute",14),je("m",gn),je("mm",gn,Da),Xr(["m","mm"],qm);var e3t=$n("Minutes",!1);re("s",["ss",2],0,"second"),dr("second","s"),Fo("second",15),je("s",gn),je("ss",gn,Da),Xr(["s","ss"],FS);var t3t=$n("Seconds",!1);re("S",0,0,function(){return~~(this.millisecond()/100)}),re(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),re(0,["SSS",3],0,"millisecond"),re(0,["SSSS",4],0,function(){return this.millisecond()*10}),re(0,["SSSSS",5],0,function(){return this.millisecond()*100}),re(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),re(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),re(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),re(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),dr("millisecond","ms"),Fo("millisecond",16),je("S",qO,Bm),je("SS",qO,Da),je("SSS",qO,th);var zO,v1e;for(zO="SSSS";zO.length<=9;zO+="S")je(zO,oa);function r3t(y,w){w[JM]=Ze(("0."+y)*1e3)}for(zO="S";zO.length<=9;zO+="S")Xr(zO,r3t);v1e=$n("Milliseconds",!1),re("z",0,0,"zoneAbbr"),re("zz",0,0,"zoneName");function n3t(){return this._isUTC?"UTC":""}function o3t(){return this._isUTC?"Coordinated Universal Time":""}var Pe=O.prototype;Pe.add=Y2t,Pe.calendar=n4t,Pe.clone=o4t,Pe.diff=d4t,Pe.endOf=w4t,Pe.format=m4t,Pe.from=g4t,Pe.fromNow=y4t,Pe.to=b4t,Pe.toNow=_4t,Pe.get=Fc,Pe.invalidAt=A4t,Pe.isAfter=i4t,Pe.isBefore=a4t,Pe.isBetween=s4t,Pe.isSame=u4t,Pe.isSameOrAfter=l4t,Pe.isSameOrBefore=c4t,Pe.isValid=T4t,Pe.lang=p1e,Pe.locale=f1e,Pe.localeData=h1e,Pe.max=T2t,Pe.min=P2t,Pe.parsingFlags=M4t,Pe.set=km,Pe.startOf=v4t,Pe.subtract=X2t,Pe.toArray=O4t,Pe.toObject=E4t,Pe.toDate=C4t,Pe.toISOString=p4t,Pe.inspect=h4t,typeof Symbol<"u"&&Symbol.for!=null&&(Pe[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Pe.toJSON=P4t,Pe.toString=f4t,Pe.unix=x4t,Pe.valueOf=S4t,Pe.creationData=R4t,Pe.eraName=N4t,Pe.eraNarrow=L4t,Pe.eraAbbr=F4t,Pe.eraYear=k4t,Pe.year=GIe,Pe.isLeapYear=Ezt,Pe.weekYear=V4t,Pe.isoWeekYear=W4t,Pe.quarter=Pe.quarters=Z4t,Pe.month=WIe,Pe.daysInMonth=xzt,Pe.week=Pe.weeks=Izt,Pe.isoWeek=Pe.isoWeeks=Dzt,Pe.weeksInYear=K4t,Pe.weeksInWeekYear=Y4t,Pe.isoWeeksInYear=J4t,Pe.isoWeeksInISOWeekYear=G4t,Pe.date=_1e,Pe.day=Pe.days=Wzt,Pe.weekday=Jzt,Pe.isoWeekday=Gzt,Pe.dayOfYear=Q4t,Pe.hour=Pe.hours=t2t,Pe.minute=Pe.minutes=e3t,Pe.second=Pe.seconds=t3t,Pe.millisecond=Pe.milliseconds=v1e,Pe.utcOffset=F2t,Pe.utc=B2t,Pe.local=$2t,Pe.parseZone=q2t,Pe.hasAlignedHourOffset=U2t,Pe.isDST=z2t,Pe.isLocal=V2t,Pe.isUtcOffset=W2t,Pe.isUtc=s1e,Pe.isUTC=s1e,Pe.zoneAbbr=n3t,Pe.zoneName=o3t,Pe.dates=M("dates accessor is deprecated. Use date instead.",_1e),Pe.months=M("months accessor is deprecated. Use month instead",WIe),Pe.years=M("years accessor is deprecated. Use year instead",GIe),Pe.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",k2t),Pe.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",H2t);function i3t(y){return gi(y*1e3)}function a3t(){return gi.apply(null,arguments).parseZone()}function w1e(y){return y}var qn=L.prototype;qn.calendar=G,qn.longDateFormat=gt,qn.invalidDate=ae,qn.ordinal=Ue,qn.preparse=w1e,qn.postformat=w1e,qn.relativeTime=Je,qn.pastFuture=cr,qn.set=k,qn.eras=I4t,qn.erasParse=D4t,qn.erasConvertYear=j4t,qn.erasAbbrRegex=$4t,qn.erasNameRegex=B4t,qn.erasNarrowRegex=q4t,qn.months=_zt,qn.monthsShort=vzt,qn.monthsParse=Szt,qn.monthsRegex=Ozt,qn.monthsShortRegex=Czt,qn.week=Tzt,qn.firstDayOfYear=Rzt,qn.firstDayOfWeek=Azt,qn.weekdays=qzt,qn.weekdaysMin=zzt,qn.weekdaysShort=Uzt,qn.weekdaysParse=Vzt,qn.weekdaysRegex=Kzt,qn.weekdaysShortRegex=Yzt,qn.weekdaysMinRegex=Xzt,qn.isPM=Qzt,qn.meridiem=r2t;function cV(y,w,P,A){var D=BS(),z=f().set(A,w);return D[P](z,y)}function S1e(y,w,P){if(u(y)&&(w=y,y=void 0),y=y||"",w!=null)return cV(y,w,P,"month");var A,D=[];for(A=0;A<12;A++)D[A]=cV(y,A,P,"month");return D}function Lae(y,w,P,A){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 D=BS(),z=y?D._week.dow:0,se,At=[];if(P!=null)return cV(w,(P+z)%7,A,"day");for(se=0;se<7;se++)At[se]=cV(w,(se+z)%7,A,"day");return At}function s3t(y,w){return S1e(y,w,"months")}function u3t(y,w){return S1e(y,w,"monthsShort")}function l3t(y,w,P){return Lae(y,w,P,"weekdays")}function c3t(y,w,P){return Lae(y,w,P,"weekdaysShort")}function d3t(y,w,P){return Lae(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=Ze(y%100/10)===1?"th":w===1?"st":w===2?"nd":w===3?"rd":"th";return y+P}}),e.lang=M("moment.lang is deprecated. Use moment.locale instead.",UO),e.langData=M("moment.langData is deprecated. Use moment.localeData instead.",BS);var $S=Math.abs;function f3t(){var y=this._data;return this._milliseconds=$S(this._milliseconds),this._days=$S(this._days),this._months=$S(this._months),y.milliseconds=$S(y.milliseconds),y.seconds=$S(y.seconds),y.minutes=$S(y.minutes),y.hours=$S(y.hours),y.months=$S(y.months),y.years=$S(y.years),this}function x1e(y,w,P,A){var D=Um(w,P);return y._milliseconds+=A*D._milliseconds,y._days+=A*D._days,y._months+=A*D._months,y._bubble()}function p3t(y,w){return x1e(this,y,w,1)}function h3t(y,w){return x1e(this,y,w,-1)}function C1e(y){return y<0?Math.floor(y):Math.ceil(y)}function m3t(){var y=this._milliseconds,w=this._days,P=this._months,A=this._data,D,z,se,At,Ir;return y>=0&&w>=0&&P>=0||y<=0&&w<=0&&P<=0||(y+=C1e(Fae(P)+w)*864e5,w=0,P=0),A.milliseconds=y%1e3,D=fr(y/1e3),A.seconds=D%60,z=fr(D/60),A.minutes=z%60,se=fr(z/60),A.hours=se%24,w+=fr(se/24),Ir=fr(O1e(w)),P+=Ir,w-=C1e(Fae(Ir)),At=fr(P/12),P%=12,A.days=w,A.months=P,A.years=At,this}function O1e(y){return y*4800/146097}function Fae(y){return y*146097/4800}function g3t(y){if(!this.isValid())return NaN;var w,P,A=this._milliseconds;if(y=qt(y),y==="month"||y==="quarter"||y==="year")switch(w=this._days+A/864e5,P=this._months+O1e(w),y){case"month":return P;case"quarter":return P/3;case"year":return P/12}else switch(w=this._days+Math.round(Fae(this._months)),y){case"week":return w/7+A/6048e5;case"day":return w+A/864e5;case"hour":return w*24+A/36e5;case"minute":return w*1440+A/6e4;case"second":return w*86400+A/1e3;case"millisecond":return Math.floor(w*864e5)+A;default:throw new Error("Unknown unit "+y)}}function y3t(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ze(this._months/12)*31536e6:NaN}function qS(y){return function(){return this.as(y)}}var b3t=qS("ms"),_3t=qS("s"),v3t=qS("m"),w3t=qS("h"),S3t=qS("d"),x3t=qS("w"),C3t=qS("M"),O3t=qS("Q"),E3t=qS("y");function P3t(){return Um(this)}function T3t(y){return y=qt(y),this.isValid()?this[y+"s"]():NaN}function KM(y){return function(){return this.isValid()?this._data[y]:NaN}}var M3t=KM("milliseconds"),A3t=KM("seconds"),R3t=KM("minutes"),I3t=KM("hours"),D3t=KM("days"),j3t=KM("months"),N3t=KM("years");function L3t(){return fr(this.days()/7)}var US=Math.round,aj={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function F3t(y,w,P,A,D){return D.relativeTime(w||1,!!P,y,A)}function k3t(y,w,P,A){var D=Um(y).abs(),z=US(D.as("s")),se=US(D.as("m")),At=US(D.as("h")),Ir=US(D.as("d")),zo=US(D.as("M")),Cd=US(D.as("w")),zS=US(D.as("y")),HO=z<=P.ss&&["s",z]||z<P.s&&["ss",z]||se<=1&&["m"]||se<P.m&&["mm",se]||At<=1&&["h"]||At<P.h&&["hh",At]||Ir<=1&&["d"]||Ir<P.d&&["dd",Ir];return P.w!=null&&(HO=HO||Cd<=1&&["w"]||Cd<P.w&&["ww",Cd]),HO=HO||zo<=1&&["M"]||zo<P.M&&["MM",zo]||zS<=1&&["y"]||["yy",zS],HO[2]=w,HO[3]=+y>0,HO[4]=A,F3t.apply(null,HO)}function B3t(y){return y===void 0?US:typeof y=="function"?(US=y,!0):!1}function $3t(y,w){return aj[y]===void 0?!1:w===void 0?aj[y]:(aj[y]=w,y==="s"&&(aj.ss=w-1),!0)}function q3t(y,w){if(!this.isValid())return this.localeData().invalidDate();var P=!1,A=aj,D,z;return typeof y=="object"&&(w=y,y=!1),typeof y=="boolean"&&(P=y),typeof w=="object"&&(A=Object.assign({},aj,w),w.s!=null&&w.ss==null&&(A.ss=w.s-1)),D=this.localeData(),z=k3t(this,!P,A,D),P&&(z=D.pastFuture(+this,z)),D.postformat(z)}var kae=Math.abs;function sj(y){return(y>0)-(y<0)||+y}function dV(){if(!this.isValid())return this.localeData().invalidDate();var y=kae(this._milliseconds)/1e3,w=kae(this._days),P=kae(this._months),A,D,z,se,At=this.asSeconds(),Ir,zo,Cd,zS;return At?(A=fr(y/60),D=fr(A/60),y%=60,A%=60,z=fr(P/12),P%=12,se=y?y.toFixed(3).replace(/\.?0+$/,""):"",Ir=At<0?"-":"",zo=sj(this._months)!==sj(At)?"-":"",Cd=sj(this._days)!==sj(At)?"-":"",zS=sj(this._milliseconds)!==sj(At)?"-":"",Ir+"P"+(z?zo+z+"Y":"")+(P?zo+P+"M":"")+(w?Cd+w+"D":"")+(D||A||y?"T":"")+(D?zS+D+"H":"")+(A?zS+A+"M":"")+(y?zS+se+"S":"")):"P0D"}var xn=oV.prototype;xn.isValid=D2t,xn.abs=f3t,xn.add=p3t,xn.subtract=h3t,xn.as=g3t,xn.asMilliseconds=b3t,xn.asSeconds=_3t,xn.asMinutes=v3t,xn.asHours=w3t,xn.asDays=S3t,xn.asWeeks=x3t,xn.asMonths=C3t,xn.asQuarters=O3t,xn.asYears=E3t,xn.valueOf=y3t,xn._bubble=m3t,xn.clone=P3t,xn.get=T3t,xn.milliseconds=M3t,xn.seconds=A3t,xn.minutes=R3t,xn.hours=I3t,xn.days=D3t,xn.weeks=L3t,xn.months=j3t,xn.years=N3t,xn.humanize=q3t,xn.toISOString=dV,xn.toString=dV,xn.toJSON=dV,xn.locale=f1e,xn.localeData=h1e,xn.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",dV),xn.lang=p1e,re("X",0,0,"unix"),re("x",0,0,"valueOf"),je("x",wd),je("X",rf),Xr("X",function(y,w,P){P._d=new Date(parseFloat(y)*1e3)}),Xr("x",function(y,w,P){P._d=new Date(Ze(y))});return e.version="2.29.4",r(gi),e.fn=Pe,e.min=M2t,e.max=A2t,e.now=R2t,e.utc=f,e.unix=i3t,e.months=s3t,e.isDate=l,e.locale=UO,e.invalid=g,e.duration=Um,e.isMoment=T,e.weekdays=l3t,e.parseZone=a3t,e.localeData=BS,e.isDuration=iV,e.monthsShort=u3t,e.weekdaysMin=d3t,e.defineLocale=Oae,e.updateLocale=a2t,e.locales=s2t,e.weekdaysShort=c3t,e.normalizeUnits=qt,e.relativeTimeRounding=B3t,e.relativeTimeThreshold=$3t,e.calendarFormat=r4t,e.prototype=Pe,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var Jke=b(si=>{"use strict";function $le(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<a9(o,e))t[n]=e,t[r]=o,r=n;else break e}}function tg(t){return t.length===0?null:t[0]}function u9(t){if(t.length===0)return null;var e=t[0],r=t.pop();if(r!==e){t[0]=r;e:for(var n=0,o=t.length,i=o>>>1;n<i;){var a=2*(n+1)-1,s=t[a],u=a+1,l=t[u];if(0>a9(s,r))u<o&&0>a9(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>a9(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function a9(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(kke=performance,si.unstable_now=function(){return kke.now()}):(Fle=Date,Bke=Fle.now(),si.unstable_now=function(){return Fle.now()-Bke});var kke,Fle,Bke,Ny=[],gE=[],yJt=1,gh=null,Jc=3,l9=!1,FA=!1,hU=!1,Uke=typeof setTimeout=="function"?setTimeout:null,zke=typeof clearTimeout=="function"?clearTimeout:null,$ke=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function qle(t){for(var e=tg(gE);e!==null;){if(e.callback===null)u9(gE);else if(e.startTime<=t)u9(gE),e.sortIndex=e.expirationTime,$le(Ny,e);else break;e=tg(gE)}}function Ule(t){if(hU=!1,qle(t),!FA)if(tg(Ny)!==null)FA=!0,Hle(zle);else{var e=tg(gE);e!==null&&Vle(Ule,e.startTime-t)}}function zle(t,e){FA=!1,hU&&(hU=!1,zke(mU),mU=-1),l9=!0;var r=Jc;try{for(qle(e),gh=tg(Ny);gh!==null&&(!(gh.expirationTime>e)||t&&!Wke());){var n=gh.callback;if(typeof n=="function"){gh.callback=null,Jc=gh.priorityLevel;var o=n(gh.expirationTime<=e);e=si.unstable_now(),typeof o=="function"?gh.callback=o:gh===tg(Ny)&&u9(Ny),qle(e)}else u9(Ny);gh=tg(Ny)}if(gh!==null)var i=!0;else{var a=tg(gE);a!==null&&Vle(Ule,a.startTime-e),i=!1}return i}finally{gh=null,Jc=r,l9=!1}}var c9=!1,s9=null,mU=-1,Hke=5,Vke=-1;function Wke(){return!(si.unstable_now()-Vke<Hke)}function kle(){if(s9!==null){var t=si.unstable_now();Vke=t;var e=!0;try{e=s9(!0,t)}finally{e?pU():(c9=!1,s9=null)}}else c9=!1}var pU;typeof $ke=="function"?pU=function(){$ke(kle)}:typeof MessageChannel<"u"?(Ble=new MessageChannel,qke=Ble.port2,Ble.port1.onmessage=kle,pU=function(){qke.postMessage(null)}):pU=function(){Uke(kle,0)};var Ble,qke;function Hle(t){s9=t,c9||(c9=!0,pU())}function Vle(t,e){mU=Uke(function(){t(si.unstable_now())},e)}si.unstable_IdlePriority=5;si.unstable_ImmediatePriority=1;si.unstable_LowPriority=4;si.unstable_NormalPriority=3;si.unstable_Profiling=null;si.unstable_UserBlockingPriority=2;si.unstable_cancelCallback=function(t){t.callback=null};si.unstable_continueExecution=function(){FA||l9||(FA=!0,Hle(zle))};si.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Hke=0<t?Math.floor(1e3/t):5};si.unstable_getCurrentPriorityLevel=function(){return Jc};si.unstable_getFirstCallbackNode=function(){return tg(Ny)};si.unstable_next=function(t){switch(Jc){case 1:case 2:case 3:var e=3;break;default:e=Jc}var r=Jc;Jc=e;try{return t()}finally{Jc=r}};si.unstable_pauseExecution=function(){};si.unstable_requestPaint=function(){};si.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Jc;Jc=t;try{return e()}finally{Jc=r}};si.unstable_scheduleCallback=function(t,e,r){var n=si.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?n+r:n):r=n,t){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,t={id:yJt++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,$le(gE,t),tg(Ny)===null&&t===tg(gE)&&(hU?(zke(mU),mU=-1):hU=!0,Vle(Ule,r-n))):(t.sortIndex=o,$le(Ny,t),FA||l9||(FA=!0,Hle(zle))),t};si.unstable_shouldYield=Wke;si.unstable_wrapCallback=function(t){var e=Jc;return function(){var r=Jc;Jc=e;try{return t.apply(this,arguments)}finally{Jc=r}}}});var Kke=b((lEn,Gke)=>{"use strict";Gke.exports=Jke()});var tUe=b(bp=>{"use strict";var r$e=Z(),gp=Kke();function Oe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n$e=new Set,FU={};function YA(t,e){yN(t,e),yN(t+"Capture",e)}function yN(t,e){for(FU[t]=e,t=0;t<e.length;t++)n$e.add(e[t])}var yx=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hce=Object.prototype.hasOwnProperty,bJt=/^[: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]*$/,Yke={},Xke={};function _Jt(t){return hce.call(Xke,t)?!0:hce.call(Yke,t)?!1:bJt.test(t)?Xke[t]=!0:(Yke[t]=!0,!1)}function vJt(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function wJt(t,e,r,n){if(e===null||typeof e>"u"||vJt(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Fd(t,e,r,n,o,i,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=a}var Zl={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Zl[t]=new Fd(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Zl[e]=new Fd(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Zl[t]=new Fd(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Zl[t]=new Fd(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Zl[t]=new Fd(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Zl[t]=new Fd(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Zl[t]=new Fd(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Zl[t]=new Fd(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Zl[t]=new Fd(t,5,!1,t.toLowerCase(),null,!1,!1)});var ade=/[\-:]([a-z])/g;function sde(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ade,sde);Zl[e]=new Fd(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ade,sde);Zl[e]=new Fd(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ade,sde);Zl[e]=new Fd(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Zl[t]=new Fd(t,1,!1,t.toLowerCase(),null,!1,!1)});Zl.xlinkHref=new Fd("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Zl[t]=new Fd(t,1,!1,t.toLowerCase(),null,!0,!0)});function ude(t,e,r,n){var o=Zl.hasOwnProperty(e)?Zl[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(wJt(e,r,o,n)&&(r=null),n||o===null?_Jt(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):o.mustUseProperty?t[o.propertyName]=r===null?o.type===3?!1:"":r:(e=o.attributeName,n=o.attributeNamespace,r===null?t.removeAttribute(e):(o=o.type,r=o===3||o===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var wx=r$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,d9=Symbol.for("react.element"),Qj=Symbol.for("react.portal"),eN=Symbol.for("react.fragment"),lde=Symbol.for("react.strict_mode"),mce=Symbol.for("react.profiler"),o$e=Symbol.for("react.provider"),i$e=Symbol.for("react.context"),cde=Symbol.for("react.forward_ref"),gce=Symbol.for("react.suspense"),yce=Symbol.for("react.suspense_list"),dde=Symbol.for("react.memo"),bE=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var a$e=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var Zke=Symbol.iterator;function gU(t){return t===null||typeof t!="object"?null:(t=Zke&&t[Zke]||t["@@iterator"],typeof t=="function"?t:null)}var ua=Object.assign,Wle;function CU(t){if(Wle===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Wle=e&&e[1]||""}return`
`+Wle+t}var Jle=!1;function Gle(t,e){if(!t||Jle)return"";Jle=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var n=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){n=l}t.call(e.prototype)}else{try{throw Error()}catch(l){n=l}t()}}catch(l){if(l&&n&&typeof l.stack=="string"){for(var o=l.stack.split(`
`),i=n.stack.split(`
`),a=o.length-1,s=i.length-1;1<=a&&0<=s&&o[a]!==i[s];)s--;for(;1<=a&&0<=s;a--,s--)if(o[a]!==i[s]){if(a!==1||s!==1)do if(a--,s--,0>s||o[a]!==i[s]){var u=`
`+o[a].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=a&&0<=s);break}}}finally{Jle=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?CU(t):""}function SJt(t){switch(t.tag){case 5:return CU(t.type);case 16:return CU("Lazy");case 13:return CU("Suspense");case 19:return CU("SuspenseList");case 0:case 2:case 15:return t=Gle(t.type,!1),t;case 11:return t=Gle(t.type.render,!1),t;case 1:return t=Gle(t.type,!0),t;default:return""}}function bce(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case eN:return"Fragment";case Qj:return"Portal";case mce:return"Profiler";case lde:return"StrictMode";case gce:return"Suspense";case yce:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case i$e:return(t.displayName||"Context")+".Consumer";case o$e:return(t._context.displayName||"Context")+".Provider";case cde:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case dde:return e=t.displayName||null,e!==null?e:bce(t.type)||"Memo";case bE:e=t._payload,t=t._init;try{return bce(t(e))}catch{}}return null}function xJt(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return bce(e);case 8:return e===lde?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function IE(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function s$e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function CJt(t){var e=s$e(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function f9(t){t._valueTracker||(t._valueTracker=CJt(t))}function u$e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=s$e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function $9(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function _ce(t,e){var r=e.checked;return ua({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Qke(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=IE(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function l$e(t,e){e=e.checked,e!=null&&ude(t,"checked",e,!1)}function vce(t,e){l$e(t,e);var r=IE(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?wce(t,e.type,r):e.hasOwnProperty("defaultValue")&&wce(t,e.type,IE(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function eBe(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function wce(t,e,r){(e!=="number"||$9(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var OU=Array.isArray;function dN(t,e,r,n){if(t=t.options,e){e={};for(var o=0;o<r.length;o++)e["$"+r[o]]=!0;for(r=0;r<t.length;r++)o=e.hasOwnProperty("$"+t[r].value),t[r].selected!==o&&(t[r].selected=o),o&&n&&(t[r].defaultSelected=!0)}else{for(r=""+IE(r),e=null,o=0;o<t.length;o++){if(t[o].value===r){t[o].selected=!0,n&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function Sce(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Oe(91));return ua({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function tBe(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Oe(92));if(OU(r)){if(1<r.length)throw Error(Oe(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:IE(r)}}function c$e(t,e){var r=IE(e.value),n=IE(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function rBe(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function d$e(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function xce(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?d$e(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var p9,f$e=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,o){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(p9=p9||document.createElement("div"),p9.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=p9.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function kU(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var TU={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},OJt=["Webkit","ms","Moz","O"];Object.keys(TU).forEach(function(t){OJt.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),TU[e]=TU[t]})});function p$e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||TU.hasOwnProperty(t)&&TU[t]?(""+e).trim():e+"px"}function h$e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=p$e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var EJt=ua({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 Cce(t,e){if(e){if(EJt[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function Oce(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ece=null;function fde(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pce=null,fN=null,pN=null;function nBe(t){if(t=rz(t)){if(typeof Pce!="function")throw Error(Oe(280));var e=t.stateNode;e&&(e=hW(e),Pce(t.stateNode,t.type,e))}}function m$e(t){fN?pN?pN.push(t):pN=[t]:fN=t}function g$e(){if(fN){var t=fN,e=pN;if(pN=fN=null,nBe(t),e)for(t=0;t<e.length;t++)nBe(e[t])}}function y$e(t,e){return t(e)}function b$e(){}var Kle=!1;function _$e(t,e,r){if(Kle)return t(e,r);Kle=!0;try{return y$e(t,e,r)}finally{Kle=!1,(fN!==null||pN!==null)&&(b$e(),g$e())}}function BU(t,e){var r=t.stateNode;if(r===null)return null;var n=hW(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(Oe(231,e,typeof r));return r}var Tce=!1;if(yx)try{Xj={},Object.defineProperty(Xj,"passive",{get:function(){Tce=!0}}),window.addEventListener("test",Xj,Xj),window.removeEventListener("test",Xj,Xj)}catch{Tce=!1}var Xj;function PJt(t,e,r,n,o,i,a,s,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(r,l)}catch(c){this.onError(c)}}var MU=!1,q9=null,U9=!1,Mce=null,TJt={onError:function(t){MU=!0,q9=t}};function MJt(t,e,r,n,o,i,a,s,u){MU=!1,q9=null,PJt.apply(TJt,arguments)}function AJt(t,e,r,n,o,i,a,s,u){if(MJt.apply(this,arguments),MU){if(MU){var l=q9;MU=!1,q9=null}else throw Error(Oe(198));U9||(U9=!0,Mce=l)}}function XA(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function v$e(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function oBe(t){if(XA(t)!==t)throw Error(Oe(188))}function RJt(t){var e=t.alternate;if(!e){if(e=XA(t),e===null)throw Error(Oe(188));return e!==t?null:t}for(var r=t,n=e;;){var o=r.return;if(o===null)break;var i=o.alternate;if(i===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===r)return oBe(o),t;if(i===n)return oBe(o),e;i=i.sibling}throw Error(Oe(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(Oe(189))}}if(r.alternate!==n)throw Error(Oe(190))}if(r.tag!==3)throw Error(Oe(188));return r.stateNode.current===r?t:e}function w$e(t){return t=RJt(t),t!==null?S$e(t):null}function S$e(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=S$e(t);if(e!==null)return e;t=t.sibling}return null}var x$e=gp.unstable_scheduleCallback,iBe=gp.unstable_cancelCallback,IJt=gp.unstable_shouldYield,DJt=gp.unstable_requestPaint,ts=gp.unstable_now,jJt=gp.unstable_getCurrentPriorityLevel,pde=gp.unstable_ImmediatePriority,C$e=gp.unstable_UserBlockingPriority,z9=gp.unstable_NormalPriority,NJt=gp.unstable_LowPriority,O$e=gp.unstable_IdlePriority,cW=null,By=null;function LJt(t){if(By&&typeof By.onCommitFiberRoot=="function")try{By.onCommitFiberRoot(cW,t,void 0,(t.current.flags&128)===128)}catch{}}var ag=Math.clz32?Math.clz32:BJt,FJt=Math.log,kJt=Math.LN2;function BJt(t){return t>>>=0,t===0?32:31-(FJt(t)/kJt|0)|0}var h9=64,m9=4194304;function EU(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function H9(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,o=t.suspendedLanes,i=t.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=EU(s):(i&=a,i!==0&&(n=EU(i)))}else a=r&~o,a!==0?n=EU(a):i!==0&&(n=EU(i));if(n===0)return 0;if(e!==0&&e!==n&&!(e&o)&&(o=n&-n,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-ag(e),o=1<<r,n|=t[r],e&=~o;return n}function $Jt(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qJt(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-ag(i),s=1<<a,u=o[a];u===-1?(!(s&r)||s&n)&&(o[a]=$Jt(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function Ace(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function E$e(){var t=h9;return h9<<=1,!(h9&4194240)&&(h9=64),t}function Yle(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function ez(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-ag(e),t[e]=r}function UJt(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var o=31-ag(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function hde(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-ag(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var ko=0;function P$e(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var T$e,mde,M$e,A$e,R$e,Rce=!1,g9=[],CE=null,OE=null,EE=null,$U=new Map,qU=new Map,vE=[],zJt="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 aBe(t,e){switch(t){case"focusin":case"focusout":CE=null;break;case"dragenter":case"dragleave":OE=null;break;case"mouseover":case"mouseout":EE=null;break;case"pointerover":case"pointerout":$U.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":qU.delete(e.pointerId)}}function yU(t,e,r,n,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[o]},e!==null&&(e=rz(e),e!==null&&mde(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function HJt(t,e,r,n,o){switch(e){case"focusin":return CE=yU(CE,t,e,r,n,o),!0;case"dragenter":return OE=yU(OE,t,e,r,n,o),!0;case"mouseover":return EE=yU(EE,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return $U.set(i,yU($U.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,qU.set(i,yU(qU.get(i)||null,t,e,r,n,o)),!0}return!1}function I$e(t){var e=$A(t.target);if(e!==null){var r=XA(e);if(r!==null){if(e=r.tag,e===13){if(e=v$e(r),e!==null){t.blockedOn=e,R$e(t.priority,function(){M$e(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function A9(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=Ice(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);Ece=n,r.target.dispatchEvent(n),Ece=null}else return e=rz(r),e!==null&&mde(e),t.blockedOn=r,!1;e.shift()}return!0}function sBe(t,e,r){A9(t)&&r.delete(e)}function VJt(){Rce=!1,CE!==null&&A9(CE)&&(CE=null),OE!==null&&A9(OE)&&(OE=null),EE!==null&&A9(EE)&&(EE=null),$U.forEach(sBe),qU.forEach(sBe)}function bU(t,e){t.blockedOn===e&&(t.blockedOn=null,Rce||(Rce=!0,gp.unstable_scheduleCallback(gp.unstable_NormalPriority,VJt)))}function UU(t){function e(o){return bU(o,t)}if(0<g9.length){bU(g9[0],t);for(var r=1;r<g9.length;r++){var n=g9[r];n.blockedOn===t&&(n.blockedOn=null)}}for(CE!==null&&bU(CE,t),OE!==null&&bU(OE,t),EE!==null&&bU(EE,t),$U.forEach(e),qU.forEach(e),r=0;r<vE.length;r++)n=vE[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<vE.length&&(r=vE[0],r.blockedOn===null);)I$e(r),r.blockedOn===null&&vE.shift()}var hN=wx.ReactCurrentBatchConfig,V9=!0;function WJt(t,e,r,n){var o=ko,i=hN.transition;hN.transition=null;try{ko=1,gde(t,e,r,n)}finally{ko=o,hN.transition=i}}function JJt(t,e,r,n){var o=ko,i=hN.transition;hN.transition=null;try{ko=4,gde(t,e,r,n)}finally{ko=o,hN.transition=i}}function gde(t,e,r,n){if(V9){var o=Ice(t,e,r,n);if(o===null)nce(t,e,n,W9,r),aBe(t,n);else if(HJt(o,t,e,r,n))n.stopPropagation();else if(aBe(t,n),e&4&&-1<zJt.indexOf(t)){for(;o!==null;){var i=rz(o);if(i!==null&&T$e(i),i=Ice(t,e,r,n),i===null&&nce(t,e,n,W9,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else nce(t,e,n,null,r)}}var W9=null;function Ice(t,e,r,n){if(W9=null,t=fde(n),t=$A(t),t!==null)if(e=XA(t),e===null)t=null;else if(r=e.tag,r===13){if(t=v$e(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return W9=t,null}function D$e(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jJt()){case pde:return 1;case C$e:return 4;case z9:case NJt:return 16;case O$e:return 536870912;default:return 16}default:return 16}}var SE=null,yde=null,R9=null;function j$e(){if(R9)return R9;var t,e=yde,r=e.length,n,o="value"in SE?SE.value:SE.textContent,i=o.length;for(t=0;t<r&&e[t]===o[t];t++);var a=r-t;for(n=1;n<=a&&e[r-n]===o[i-n];n++);return R9=o.slice(t,1<n?1-n:void 0)}function I9(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function y9(){return!0}function uBe(){return!1}function yp(t){function e(r,n,o,i,a){this._reactName=r,this._targetInst=o,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(r=t[s],this[s]=r?r(i):i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?y9:uBe,this.isPropagationStopped=uBe,this}return ua(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=y9)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=y9)},persist:function(){},isPersistent:y9}),e}var CN={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bde=yp(CN),tz=ua({},CN,{view:0,detail:0}),GJt=yp(tz),Xle,Zle,_U,dW=ua({},tz,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_de,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_U&&(_U&&t.type==="mousemove"?(Xle=t.screenX-_U.screenX,Zle=t.screenY-_U.screenY):Zle=Xle=0,_U=t),Xle)},movementY:function(t){return"movementY"in t?t.movementY:Zle}}),lBe=yp(dW),KJt=ua({},dW,{dataTransfer:0}),YJt=yp(KJt),XJt=ua({},tz,{relatedTarget:0}),Qle=yp(XJt),ZJt=ua({},CN,{animationName:0,elapsedTime:0,pseudoElement:0}),QJt=yp(ZJt),eGt=ua({},CN,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),tGt=yp(eGt),rGt=ua({},CN,{data:0}),cBe=yp(rGt),nGt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oGt={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"},iGt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aGt(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=iGt[t])?!!e[t]:!1}function _de(){return aGt}var sGt=ua({},tz,{key:function(t){if(t.key){var e=nGt[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=I9(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?oGt[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_de,charCode:function(t){return t.type==="keypress"?I9(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?I9(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),uGt=yp(sGt),lGt=ua({},dW,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dBe=yp(lGt),cGt=ua({},tz,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_de}),dGt=yp(cGt),fGt=ua({},CN,{propertyName:0,elapsedTime:0,pseudoElement:0}),pGt=yp(fGt),hGt=ua({},dW,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),mGt=yp(hGt),gGt=[9,13,27,32],vde=yx&&"CompositionEvent"in window,AU=null;yx&&"documentMode"in document&&(AU=document.documentMode);var yGt=yx&&"TextEvent"in window&&!AU,N$e=yx&&(!vde||AU&&8<AU&&11>=AU),fBe=String.fromCharCode(32),pBe=!1;function L$e(t,e){switch(t){case"keyup":return gGt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function F$e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var tN=!1;function bGt(t,e){switch(t){case"compositionend":return F$e(e);case"keypress":return e.which!==32?null:(pBe=!0,fBe);case"textInput":return t=e.data,t===fBe&&pBe?null:t;default:return null}}function _Gt(t,e){if(tN)return t==="compositionend"||!vde&&L$e(t,e)?(t=j$e(),R9=yde=SE=null,tN=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return N$e&&e.locale!=="ko"?null:e.data;default:return null}}var vGt={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 hBe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!vGt[t.type]:e==="textarea"}function k$e(t,e,r,n){m$e(n),e=J9(e,"onChange"),0<e.length&&(r=new bde("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var RU=null,zU=null;function wGt(t){K$e(t,0)}function fW(t){var e=oN(t);if(u$e(e))return t}function SGt(t,e){if(t==="change")return e}var B$e=!1;yx&&(yx?(_9="oninput"in document,_9||(ece=document.createElement("div"),ece.setAttribute("oninput","return;"),_9=typeof ece.oninput=="function"),b9=_9):b9=!1,B$e=b9&&(!document.documentMode||9<document.documentMode));var b9,_9,ece;function mBe(){RU&&(RU.detachEvent("onpropertychange",$$e),zU=RU=null)}function $$e(t){if(t.propertyName==="value"&&fW(zU)){var e=[];k$e(e,zU,t,fde(t)),_$e(wGt,e)}}function xGt(t,e,r){t==="focusin"?(mBe(),RU=e,zU=r,RU.attachEvent("onpropertychange",$$e)):t==="focusout"&&mBe()}function CGt(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return fW(zU)}function OGt(t,e){if(t==="click")return fW(e)}function EGt(t,e){if(t==="input"||t==="change")return fW(e)}function PGt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ug=typeof Object.is=="function"?Object.is:PGt;function HU(t,e){if(ug(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var o=r[n];if(!hce.call(e,o)||!ug(t[o],e[o]))return!1}return!0}function gBe(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function yBe(t,e){var r=gBe(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=gBe(r)}}function q$e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?q$e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function U$e(){for(var t=window,e=$9();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=$9(t.document)}return e}function wde(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function TGt(t){var e=U$e(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&q$e(r.ownerDocument.documentElement,r)){if(n!==null&&wde(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!t.extend&&i>n&&(o=n,n=i,i=o),o=yBe(r,i);var a=yBe(r,n);o&&a&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var MGt=yx&&"documentMode"in document&&11>=document.documentMode,rN=null,Dce=null,IU=null,jce=!1;function bBe(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;jce||rN==null||rN!==$9(n)||(n=rN,"selectionStart"in n&&wde(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}),IU&&HU(IU,n)||(IU=n,n=J9(Dce,"onSelect"),0<n.length&&(e=new bde("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=rN)))}function v9(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var nN={animationend:v9("Animation","AnimationEnd"),animationiteration:v9("Animation","AnimationIteration"),animationstart:v9("Animation","AnimationStart"),transitionend:v9("Transition","TransitionEnd")},tce={},z$e={};yx&&(z$e=document.createElement("div").style,"AnimationEvent"in window||(delete nN.animationend.animation,delete nN.animationiteration.animation,delete nN.animationstart.animation),"TransitionEvent"in window||delete nN.transitionend.transition);function pW(t){if(tce[t])return tce[t];if(!nN[t])return t;var e=nN[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in z$e)return tce[t]=e[r];return t}var H$e=pW("animationend"),V$e=pW("animationiteration"),W$e=pW("animationstart"),J$e=pW("transitionend"),G$e=new Map,_Be="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 jE(t,e){G$e.set(t,e),YA(e,[t])}for(w9=0;w9<_Be.length;w9++)S9=_Be[w9],vBe=S9.toLowerCase(),wBe=S9[0].toUpperCase()+S9.slice(1),jE(vBe,"on"+wBe);var S9,vBe,wBe,w9;jE(H$e,"onAnimationEnd");jE(V$e,"onAnimationIteration");jE(W$e,"onAnimationStart");jE("dblclick","onDoubleClick");jE("focusin","onFocus");jE("focusout","onBlur");jE(J$e,"onTransitionEnd");yN("onMouseEnter",["mouseout","mouseover"]);yN("onMouseLeave",["mouseout","mouseover"]);yN("onPointerEnter",["pointerout","pointerover"]);yN("onPointerLeave",["pointerout","pointerover"]);YA("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));YA("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));YA("onBeforeInput",["compositionend","keypress","textInput","paste"]);YA("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));YA("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));YA("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var PU="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(" "),AGt=new Set("cancel close invalid load scroll toggle".split(" ").concat(PU));function SBe(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,AJt(n,e,void 0,t),t.currentTarget=null}function K$e(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],o=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var a=n.length-1;0<=a;a--){var s=n[a],u=s.instance,l=s.currentTarget;if(s=s.listener,u!==i&&o.isPropagationStopped())break e;SBe(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;SBe(o,s,l),i=u}}}if(U9)throw t=Mce,U9=!1,Mce=null,t}function vi(t,e){var r=e[Bce];r===void 0&&(r=e[Bce]=new Set);var n=t+"__bubble";r.has(n)||(Y$e(e,t,2,!1),r.add(n))}function rce(t,e,r){var n=0;e&&(n|=4),Y$e(r,t,n,e)}var x9="_reactListening"+Math.random().toString(36).slice(2);function VU(t){if(!t[x9]){t[x9]=!0,n$e.forEach(function(r){r!=="selectionchange"&&(AGt.has(r)||rce(r,!1,t),rce(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[x9]||(e[x9]=!0,rce("selectionchange",!1,e))}}function Y$e(t,e,r,n){switch(D$e(e)){case 1:var o=WJt;break;case 4:o=JJt;break;default:o=gde}r=o.bind(null,e,r,t),o=void 0,!Tce||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),n?o!==void 0?t.addEventListener(e,r,{capture:!0,passive:o}):t.addEventListener(e,r,!0):o!==void 0?t.addEventListener(e,r,{passive:o}):t.addEventListener(e,r,!1)}function nce(t,e,r,n,o){var i=n;if(!(e&1)&&!(e&2)&&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=$A(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}_$e(function(){var l=i,c=fde(r),d=[];e:{var f=G$e.get(t);if(f!==void 0){var p=bde,h=t;switch(t){case"keypress":if(I9(r)===0)break e;case"keydown":case"keyup":p=uGt;break;case"focusin":h="focus",p=Qle;break;case"focusout":h="blur",p=Qle;break;case"beforeblur":case"afterblur":p=Qle;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=lBe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=YJt;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=dGt;break;case H$e:case V$e:case W$e:p=QJt;break;case J$e:p=pGt;break;case"scroll":p=GJt;break;case"wheel":p=mGt;break;case"copy":case"cut":case"paste":p=tGt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=dBe}var m=(e&4)!==0,v=!m&&t==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var _=l,S;_!==null;){S=_;var x=S.stateNode;if(S.tag===5&&x!==null&&(S=x,g!==null&&(x=BU(_,g),x!=null&&m.push(WU(_,x,S)))),v)break;_=_.return}0<m.length&&(f=new p(f,h,null,r,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==Ece&&(h=r.relatedTarget||r.fromElement)&&($A(h)||h[bx]))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?$A(h):null,h!==null&&(v=XA(h),h!==v||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=lBe,x="onMouseLeave",g="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(m=dBe,x="onPointerLeave",g="onPointerEnter",_="pointer"),v=p==null?f:oN(p),S=h==null?f:oN(h),f=new m(x,_+"leave",p,r,c),f.target=v,f.relatedTarget=S,x=null,$A(c)===l&&(m=new m(g,_+"enter",h,r,c),m.target=S,m.relatedTarget=v,x=m),v=x,p&&h)t:{for(m=p,g=h,_=0,S=m;S;S=Zj(S))_++;for(S=0,x=g;x;x=Zj(x))S++;for(;0<_-S;)m=Zj(m),_--;for(;0<S-_;)g=Zj(g),S--;for(;_--;){if(m===g||g!==null&&m===g.alternate)break t;m=Zj(m),g=Zj(g)}m=null}else m=null;p!==null&&xBe(d,f,p,m,!1),h!==null&&v!==null&&xBe(d,v,h,m,!0)}}e:{if(f=l?oN(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var O=SGt;else if(hBe(f))if(B$e)O=EGt;else{O=CGt;var T=xGt}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=OGt);if(O&&(O=O(t,l))){k$e(d,O,r,c);break e}T&&T(t,f,l),t==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&wce(f,"number",f.value)}switch(T=l?oN(l):window,t){case"focusin":(hBe(T)||T.contentEditable==="true")&&(rN=T,Dce=l,IU=null);break;case"focusout":IU=Dce=rN=null;break;case"mousedown":jce=!0;break;case"contextmenu":case"mouseup":case"dragend":jce=!1,bBe(d,r,c);break;case"selectionchange":if(MGt)break;case"keydown":case"keyup":bBe(d,r,c)}var E;if(vde)e:{switch(t){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else tN?L$e(t,r)&&(M="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(M="onCompositionStart");M&&(N$e&&r.locale!=="ko"&&(tN||M!=="onCompositionStart"?M==="onCompositionEnd"&&tN&&(E=j$e()):(SE=c,yde="value"in SE?SE.value:SE.textContent,tN=!0)),T=J9(l,M),0<T.length&&(M=new cBe(M,t,null,r,c),d.push({event:M,listeners:T}),E?M.data=E:(E=F$e(r),E!==null&&(M.data=E)))),(E=yGt?bGt(t,r):_Gt(t,r))&&(l=J9(l,"onBeforeInput"),0<l.length&&(c=new cBe("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}K$e(d,e)})}function WU(t,e,r){return{instance:t,listener:e,currentTarget:r}}function J9(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=BU(t,r),i!=null&&n.unshift(WU(t,i,o)),i=BU(t,e),i!=null&&n.push(WU(t,i,o))),t=t.return}return n}function Zj(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function xBe(t,e,r,n,o){for(var i=e._reactName,a=[];r!==null&&r!==n;){var s=r,u=s.alternate,l=s.stateNode;if(u!==null&&u===n)break;s.tag===5&&l!==null&&(s=l,o?(u=BU(r,i),u!=null&&a.unshift(WU(r,u,s))):o||(u=BU(r,i),u!=null&&a.push(WU(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var RGt=/\r\n?/g,IGt=/\u0000|\uFFFD/g;function CBe(t){return(typeof t=="string"?t:""+t).replace(RGt,`
`).replace(IGt,"")}function C9(t,e,r){if(e=CBe(e),CBe(t)!==e&&r)throw Error(Oe(425))}function G9(){}var Nce=null,Lce=null;function Fce(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var kce=typeof setTimeout=="function"?setTimeout:void 0,DGt=typeof clearTimeout=="function"?clearTimeout:void 0,OBe=typeof Promise=="function"?Promise:void 0,jGt=typeof queueMicrotask=="function"?queueMicrotask:typeof OBe<"u"?function(t){return OBe.resolve(null).then(t).catch(NGt)}:kce;function NGt(t){setTimeout(function(){throw t})}function oce(t,e){var r=e,n=0;do{var o=r.nextSibling;if(t.removeChild(r),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(n===0){t.removeChild(o),UU(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);UU(e)}function PE(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function EBe(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var ON=Math.random().toString(36).slice(2),ky="__reactFiber$"+ON,JU="__reactProps$"+ON,bx="__reactContainer$"+ON,Bce="__reactEvents$"+ON,LGt="__reactListeners$"+ON,FGt="__reactHandles$"+ON;function $A(t){var e=t[ky];if(e)return e;for(var r=t.parentNode;r;){if(e=r[bx]||r[ky]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=EBe(t);t!==null;){if(r=t[ky])return r;t=EBe(t)}return e}t=r,r=t.parentNode}return null}function rz(t){return t=t[ky]||t[bx],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function oN(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Oe(33))}function hW(t){return t[JU]||null}var $ce=[],iN=-1;function NE(t){return{current:t}}function wi(t){0>iN||(t.current=$ce[iN],$ce[iN]=null,iN--)}function ui(t,e){iN++,$ce[iN]=t.current,t.current=e}var DE={},Xc=NE(DE),bf=NE(!1),VA=DE;function bN(t,e){var r=t.type.contextTypes;if(!r)return DE;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function _f(t){return t=t.childContextTypes,t!=null}function K9(){wi(bf),wi(Xc)}function PBe(t,e,r){if(Xc.current!==DE)throw Error(Oe(168));ui(Xc,e),ui(bf,r)}function X$e(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in e))throw Error(Oe(108,xJt(t)||"Unknown",o));return ua({},r,n)}function Y9(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||DE,VA=Xc.current,ui(Xc,t),ui(bf,bf.current),!0}function TBe(t,e,r){var n=t.stateNode;if(!n)throw Error(Oe(169));r?(t=X$e(t,e,VA),n.__reactInternalMemoizedMergedChildContext=t,wi(bf),wi(Xc),ui(Xc,t)):wi(bf),ui(bf,r)}var px=null,mW=!1,ice=!1;function Z$e(t){px===null?px=[t]:px.push(t)}function kGt(t){mW=!0,Z$e(t)}function LE(){if(!ice&&px!==null){ice=!0;var t=0,e=ko;try{var r=px;for(ko=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}px=null,mW=!1}catch(o){throw px!==null&&(px=px.slice(t+1)),x$e(pde,LE),o}finally{ko=e,ice=!1}}return null}var aN=[],sN=0,X9=null,Z9=0,yh=[],bh=0,WA=null,hx=1,mx="";function kA(t,e){aN[sN++]=Z9,aN[sN++]=X9,X9=t,Z9=e}function Q$e(t,e,r){yh[bh++]=hx,yh[bh++]=mx,yh[bh++]=WA,WA=t;var n=hx;t=mx;var o=32-ag(n)-1;n&=~(1<<o),r+=1;var i=32-ag(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,hx=1<<32-ag(e)+o|r<<o|n,mx=i+t}else hx=1<<i|r<<o|n,mx=t}function Sde(t){t.return!==null&&(kA(t,1),Q$e(t,1,0))}function xde(t){for(;t===X9;)X9=aN[--sN],aN[sN]=null,Z9=aN[--sN],aN[sN]=null;for(;t===WA;)WA=yh[--bh],yh[bh]=null,mx=yh[--bh],yh[bh]=null,hx=yh[--bh],yh[bh]=null}var mp=null,hp=null,Ui=!1,ig=null;function eqe(t,e){var r=_h(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function MBe(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,mp=t,hp=PE(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,mp=t,hp=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=WA!==null?{id:hx,overflow:mx}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=_h(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,mp=t,hp=null,!0):!1;default:return!1}}function qce(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Uce(t){if(Ui){var e=hp;if(e){var r=e;if(!MBe(t,e)){if(qce(t))throw Error(Oe(418));e=PE(r.nextSibling);var n=mp;e&&MBe(t,e)?eqe(n,r):(t.flags=t.flags&-4097|2,Ui=!1,mp=t)}}else{if(qce(t))throw Error(Oe(418));t.flags=t.flags&-4097|2,Ui=!1,mp=t}}}function ABe(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;mp=t}function O9(t){if(t!==mp)return!1;if(!Ui)return ABe(t),Ui=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Fce(t.type,t.memoizedProps)),e&&(e=hp)){if(qce(t))throw tqe(),Error(Oe(418));for(;e;)eqe(t,e),e=PE(e.nextSibling)}if(ABe(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Oe(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){hp=PE(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}hp=null}}else hp=mp?PE(t.stateNode.nextSibling):null;return!0}function tqe(){for(var t=hp;t;)t=PE(t.nextSibling)}function _N(){hp=mp=null,Ui=!1}function Cde(t){ig===null?ig=[t]:ig.push(t)}var BGt=wx.ReactCurrentBatchConfig;function ng(t,e){if(t&&t.defaultProps){e=ua({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var Q9=NE(null),eW=null,uN=null,Ode=null;function Ede(){Ode=uN=eW=null}function Pde(t){var e=Q9.current;wi(Q9),t._currentValue=e}function zce(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function mN(t,e){eW=t,Ode=uN=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(yf=!0),t.firstContext=null)}function wh(t){var e=t._currentValue;if(Ode!==t)if(t={context:t,memoizedValue:e,next:null},uN===null){if(eW===null)throw Error(Oe(308));uN=t,eW.dependencies={lanes:0,firstContext:t}}else uN=uN.next=t;return e}var qA=null;function Tde(t){qA===null?qA=[t]:qA.push(t)}function rqe(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,Tde(e)):(r.next=o.next,o.next=r),e.interleaved=r,_x(t,n)}function _x(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var _E=!1;function Mde(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nqe(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function gx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function TE(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,kn&2){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,_x(t,r)}return o=n.interleaved,o===null?(e.next=e,Tde(n)):(e.next=o.next,o.next=e),n.interleaved=e,_x(t,r)}function D9(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,hde(t,r)}}function RBe(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var o=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?o=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?o=i=e:i=i.next=e}else o=i=e;r={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function tW(t,e,r,n){var o=t.updateQueue;_E=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=t.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var h=t,m=s;switch(f=e,p=r,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=ua({},d,f);break e;case 2:_E=!0}}s.callback!==null&&s.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,a|=f;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;f=s,s=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(1);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do a|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);GA|=a,t.lanes=a,t.memoizedState=d}}function IBe(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],o=n.callback;if(o!==null){if(n.callback=null,n=r,typeof o!="function")throw Error(Oe(191,o));o.call(n)}}}var oqe=new r$e.Component().refs;function Hce(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:ua({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var gW={isMounted:function(t){return(t=t._reactInternals)?XA(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Ld(),o=AE(t),i=gx(n,o);i.payload=e,r!=null&&(i.callback=r),e=TE(t,i,o),e!==null&&(sg(e,t,o,n),D9(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Ld(),o=AE(t),i=gx(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=TE(t,i,o),e!==null&&(sg(e,t,o,n),D9(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Ld(),n=AE(t),o=gx(r,n);o.tag=2,e!=null&&(o.callback=e),e=TE(t,o,n),e!==null&&(sg(e,t,n,r),D9(e,t,n))}};function DBe(t,e,r,n,o,i,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,a):e.prototype&&e.prototype.isPureReactComponent?!HU(r,n)||!HU(o,i):!0}function iqe(t,e,r){var n=!1,o=DE,i=e.contextType;return typeof i=="object"&&i!==null?i=wh(i):(o=_f(e)?VA:Xc.current,n=e.contextTypes,i=(n=n!=null)?bN(t,o):DE),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=gW,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function jBe(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&gW.enqueueReplaceState(e,e.state,null)}function Vce(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=oqe,Mde(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=wh(i):(i=_f(e)?VA:Xc.current,o.context=bN(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Hce(t,e,i,r),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&gW.enqueueReplaceState(o,o.state,null),tW(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function vU(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Oe(309));var n=r.stateNode}if(!n)throw Error(Oe(147,t));var o=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(a){var s=o.refs;s===oqe&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(Oe(284));if(!r._owner)throw Error(Oe(290,t))}return t}function E9(t,e){throw t=Object.prototype.toString.call(e),Error(Oe(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function NBe(t){var e=t._init;return e(t._payload)}function aqe(t){function e(g,_){if(t){var S=g.deletions;S===null?(g.deletions=[_],g.flags|=16):S.push(_)}}function r(g,_){if(!t)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function n(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function o(g,_){return g=RE(g,_),g.index=0,g.sibling=null,g}function i(g,_,S){return g.index=S,t?(S=g.alternate,S!==null?(S=S.index,S<_?(g.flags|=2,_):S):(g.flags|=2,_)):(g.flags|=1048576,_)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,_,S,x){return _===null||_.tag!==6?(_=fce(S,g.mode,x),_.return=g,_):(_=o(_,S),_.return=g,_)}function u(g,_,S,x){var O=S.type;return O===eN?c(g,_,S.props.children,x,S.key):_!==null&&(_.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===bE&&NBe(O)===_.type)?(x=o(_,S.props),x.ref=vU(g,_,S),x.return=g,x):(x=B9(S.type,S.key,S.props,null,g.mode,x),x.ref=vU(g,_,S),x.return=g,x)}function l(g,_,S,x){return _===null||_.tag!==4||_.stateNode.containerInfo!==S.containerInfo||_.stateNode.implementation!==S.implementation?(_=pce(S,g.mode,x),_.return=g,_):(_=o(_,S.children||[]),_.return=g,_)}function c(g,_,S,x,O){return _===null||_.tag!==7?(_=HA(S,g.mode,x,O),_.return=g,_):(_=o(_,S),_.return=g,_)}function d(g,_,S){if(typeof _=="string"&&_!==""||typeof _=="number")return _=fce(""+_,g.mode,S),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case d9:return S=B9(_.type,_.key,_.props,null,g.mode,S),S.ref=vU(g,null,_),S.return=g,S;case Qj:return _=pce(_,g.mode,S),_.return=g,_;case bE:var x=_._init;return d(g,x(_._payload),S)}if(OU(_)||gU(_))return _=HA(_,g.mode,S,null),_.return=g,_;E9(g,_)}return null}function f(g,_,S,x){var O=_!==null?_.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return O!==null?null:s(g,_,""+S,x);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case d9:return S.key===O?u(g,_,S,x):null;case Qj:return S.key===O?l(g,_,S,x):null;case bE:return O=S._init,f(g,_,O(S._payload),x)}if(OU(S)||gU(S))return O!==null?null:c(g,_,S,x,null);E9(g,S)}return null}function p(g,_,S,x,O){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(S)||null,s(_,g,""+x,O);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case d9:return g=g.get(x.key===null?S:x.key)||null,u(_,g,x,O);case Qj:return g=g.get(x.key===null?S:x.key)||null,l(_,g,x,O);case bE:var T=x._init;return p(g,_,S,T(x._payload),O)}if(OU(x)||gU(x))return g=g.get(S)||null,c(_,g,x,O,null);E9(_,x)}return null}function h(g,_,S,x){for(var O=null,T=null,E=_,M=_=0,R=null;E!==null&&M<S.length;M++){E.index>M?(R=E,E=null):R=E.sibling;var N=f(g,E,S[M],x);if(N===null){E===null&&(E=R);break}t&&E&&N.alternate===null&&e(g,E),_=i(N,_,M),T===null?O=N:T.sibling=N,T=N,E=R}if(M===S.length)return r(g,E),Ui&&kA(g,M),O;if(E===null){for(;M<S.length;M++)E=d(g,S[M],x),E!==null&&(_=i(E,_,M),T===null?O=E:T.sibling=E,T=E);return Ui&&kA(g,M),O}for(E=n(g,E);M<S.length;M++)R=p(E,g,M,S[M],x),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?M:R.key),_=i(R,_,M),T===null?O=R:T.sibling=R,T=R);return t&&E.forEach(function(j){return e(g,j)}),Ui&&kA(g,M),O}function m(g,_,S,x){var O=gU(S);if(typeof O!="function")throw Error(Oe(150));if(S=O.call(S),S==null)throw Error(Oe(151));for(var T=O=null,E=_,M=_=0,R=null,N=S.next();E!==null&&!N.done;M++,N=S.next()){E.index>M?(R=E,E=null):R=E.sibling;var j=f(g,E,N.value,x);if(j===null){E===null&&(E=R);break}t&&E&&j.alternate===null&&e(g,E),_=i(j,_,M),T===null?O=j:T.sibling=j,T=j,E=R}if(N.done)return r(g,E),Ui&&kA(g,M),O;if(E===null){for(;!N.done;M++,N=S.next())N=d(g,N.value,x),N!==null&&(_=i(N,_,M),T===null?O=N:T.sibling=N,T=N);return Ui&&kA(g,M),O}for(E=n(g,E);!N.done;M++,N=S.next())N=p(E,g,M,N.value,x),N!==null&&(t&&N.alternate!==null&&E.delete(N.key===null?M:N.key),_=i(N,_,M),T===null?O=N:T.sibling=N,T=N);return t&&E.forEach(function(k){return e(g,k)}),Ui&&kA(g,M),O}function v(g,_,S,x){if(typeof S=="object"&&S!==null&&S.type===eN&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case d9:e:{for(var O=S.key,T=_;T!==null;){if(T.key===O){if(O=S.type,O===eN){if(T.tag===7){r(g,T.sibling),_=o(T,S.props.children),_.return=g,g=_;break e}}else if(T.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===bE&&NBe(O)===T.type){r(g,T.sibling),_=o(T,S.props),_.ref=vU(g,T,S),_.return=g,g=_;break e}r(g,T);break}else e(g,T);T=T.sibling}S.type===eN?(_=HA(S.props.children,g.mode,x,S.key),_.return=g,g=_):(x=B9(S.type,S.key,S.props,null,g.mode,x),x.ref=vU(g,_,S),x.return=g,g=x)}return a(g);case Qj:e:{for(T=S.key;_!==null;){if(_.key===T)if(_.tag===4&&_.stateNode.containerInfo===S.containerInfo&&_.stateNode.implementation===S.implementation){r(g,_.sibling),_=o(_,S.children||[]),_.return=g,g=_;break e}else{r(g,_);break}else e(g,_);_=_.sibling}_=pce(S,g.mode,x),_.return=g,g=_}return a(g);case bE:return T=S._init,v(g,_,T(S._payload),x)}if(OU(S))return h(g,_,S,x);if(gU(S))return m(g,_,S,x);E9(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,_!==null&&_.tag===6?(r(g,_.sibling),_=o(_,S),_.return=g,g=_):(r(g,_),_=fce(S,g.mode,x),_.return=g,g=_),a(g)):r(g,_)}return v}var vN=aqe(!0),sqe=aqe(!1),nz={},$y=NE(nz),GU=NE(nz),KU=NE(nz);function UA(t){if(t===nz)throw Error(Oe(174));return t}function Ade(t,e){switch(ui(KU,e),ui(GU,t),ui($y,nz),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:xce(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=xce(e,t)}wi($y),ui($y,e)}function wN(){wi($y),wi(GU),wi(KU)}function uqe(t){UA(KU.current);var e=UA($y.current),r=xce(e,t.type);e!==r&&(ui(GU,t),ui($y,r))}function Rde(t){GU.current===t&&(wi($y),wi(GU))}var aa=NE(0);function rW(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var ace=[];function Ide(){for(var t=0;t<ace.length;t++)ace[t]._workInProgressVersionPrimary=null;ace.length=0}var j9=wx.ReactCurrentDispatcher,sce=wx.ReactCurrentBatchConfig,JA=0,sa=null,Xu=null,vl=null,nW=!1,DU=!1,YU=0,$Gt=0;function Gc(){throw Error(Oe(321))}function Dde(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!ug(t[r],e[r]))return!1;return!0}function jde(t,e,r,n,o,i){if(JA=i,sa=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,j9.current=t===null||t.memoizedState===null?HGt:VGt,t=r(n,o),DU){i=0;do{if(DU=!1,YU=0,25<=i)throw Error(Oe(301));i+=1,vl=Xu=null,e.updateQueue=null,j9.current=WGt,t=r(n,o)}while(DU)}if(j9.current=oW,e=Xu!==null&&Xu.next!==null,JA=0,vl=Xu=sa=null,nW=!1,e)throw Error(Oe(300));return t}function Nde(){var t=YU!==0;return YU=0,t}function Fy(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vl===null?sa.memoizedState=vl=t:vl=vl.next=t,vl}function Sh(){if(Xu===null){var t=sa.alternate;t=t!==null?t.memoizedState:null}else t=Xu.next;var e=vl===null?sa.memoizedState:vl.next;if(e!==null)vl=e,Xu=t;else{if(t===null)throw Error(Oe(310));Xu=t,t={memoizedState:Xu.memoizedState,baseState:Xu.baseState,baseQueue:Xu.baseQueue,queue:Xu.queue,next:null},vl===null?sa.memoizedState=vl=t:vl=vl.next=t}return vl}function XU(t,e){return typeof e=="function"?e(t):e}function uce(t){var e=Sh(),r=e.queue;if(r===null)throw Error(Oe(311));r.lastRenderedReducer=t;var n=Xu,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((JA&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),n=l.hasEagerState?l.eagerState:t(n,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(s=u=d,a=n):u=u.next=d,sa.lanes|=c,GA|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,ug(n,e.memoizedState)||(yf=!0),e.memoizedState=n,e.baseState=a,e.baseQueue=u,r.lastRenderedState=n}if(t=r.interleaved,t!==null){o=t;do i=o.lane,sa.lanes|=i,GA|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function lce(t){var e=Sh(),r=e.queue;if(r===null)throw Error(Oe(311));r.lastRenderedReducer=t;var n=r.dispatch,o=r.pending,i=e.memoizedState;if(o!==null){r.pending=null;var a=o=o.next;do i=t(i,a.action),a=a.next;while(a!==o);ug(i,e.memoizedState)||(yf=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function lqe(){}function cqe(t,e){var r=sa,n=Sh(),o=e(),i=!ug(n.memoizedState,o);if(i&&(n.memoizedState=o,yf=!0),n=n.queue,Lde(pqe.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||vl!==null&&vl.memoizedState.tag&1){if(r.flags|=2048,ZU(9,fqe.bind(null,r,n,o,e),void 0,null),wl===null)throw Error(Oe(349));JA&30||dqe(r,e,o)}return o}function dqe(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=sa.updateQueue,e===null?(e={lastEffect:null,stores:null},sa.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function fqe(t,e,r,n){e.value=r,e.getSnapshot=n,hqe(e)&&mqe(t)}function pqe(t,e,r){return r(function(){hqe(e)&&mqe(t)})}function hqe(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!ug(t,r)}catch{return!0}}function mqe(t){var e=_x(t,1);e!==null&&sg(e,t,1,-1)}function LBe(t){var e=Fy();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:XU,lastRenderedState:t},e.queue=t,t=t.dispatch=zGt.bind(null,sa,t),[e.memoizedState,t]}function ZU(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=sa.updateQueue,e===null?(e={lastEffect:null,stores:null},sa.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function gqe(){return Sh().memoizedState}function N9(t,e,r,n){var o=Fy();sa.flags|=t,o.memoizedState=ZU(1|e,r,void 0,n===void 0?null:n)}function yW(t,e,r,n){var o=Sh();n=n===void 0?null:n;var i=void 0;if(Xu!==null){var a=Xu.memoizedState;if(i=a.destroy,n!==null&&Dde(n,a.deps)){o.memoizedState=ZU(e,r,i,n);return}}sa.flags|=t,o.memoizedState=ZU(1|e,r,i,n)}function FBe(t,e){return N9(8390656,8,t,e)}function Lde(t,e){return yW(2048,8,t,e)}function yqe(t,e){return yW(4,2,t,e)}function bqe(t,e){return yW(4,4,t,e)}function _qe(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function vqe(t,e,r){return r=r!=null?r.concat([t]):null,yW(4,4,_qe.bind(null,e,t),r)}function Fde(){}function wqe(t,e){var r=Sh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&Dde(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Sqe(t,e){var r=Sh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&Dde(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function xqe(t,e,r){return JA&21?(ug(r,e)||(r=E$e(),sa.lanes|=r,GA|=r,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,yf=!0),t.memoizedState=r)}function qGt(t,e){var r=ko;ko=r!==0&&4>r?r:4,t(!0);var n=sce.transition;sce.transition={};try{t(!1),e()}finally{ko=r,sce.transition=n}}function Cqe(){return Sh().memoizedState}function UGt(t,e,r){var n=AE(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Oqe(t))Eqe(e,r);else if(r=rqe(t,e,r,n),r!==null){var o=Ld();sg(r,t,n,o),Pqe(r,e,n)}}function zGt(t,e,r){var n=AE(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Oqe(t))Eqe(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,ug(s,a)){var u=e.interleaved;u===null?(o.next=o,Tde(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=rqe(t,e,o,n),r!==null&&(o=Ld(),sg(r,t,n,o),Pqe(r,e,n))}}function Oqe(t){var e=t.alternate;return t===sa||e!==null&&e===sa}function Eqe(t,e){DU=nW=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Pqe(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,hde(t,r)}}var oW={readContext:wh,useCallback:Gc,useContext:Gc,useEffect:Gc,useImperativeHandle:Gc,useInsertionEffect:Gc,useLayoutEffect:Gc,useMemo:Gc,useReducer:Gc,useRef:Gc,useState:Gc,useDebugValue:Gc,useDeferredValue:Gc,useTransition:Gc,useMutableSource:Gc,useSyncExternalStore:Gc,useId:Gc,unstable_isNewReconciler:!1},HGt={readContext:wh,useCallback:function(t,e){return Fy().memoizedState=[t,e===void 0?null:e],t},useContext:wh,useEffect:FBe,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,N9(4194308,4,_qe.bind(null,e,t),r)},useLayoutEffect:function(t,e){return N9(4194308,4,t,e)},useInsertionEffect:function(t,e){return N9(4,2,t,e)},useMemo:function(t,e){var r=Fy();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Fy();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=UGt.bind(null,sa,t),[n.memoizedState,t]},useRef:function(t){var e=Fy();return t={current:t},e.memoizedState=t},useState:LBe,useDebugValue:Fde,useDeferredValue:function(t){return Fy().memoizedState=t},useTransition:function(){var t=LBe(!1),e=t[0];return t=qGt.bind(null,t[1]),Fy().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=sa,o=Fy();if(Ui){if(r===void 0)throw Error(Oe(407));r=r()}else{if(r=e(),wl===null)throw Error(Oe(349));JA&30||dqe(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,FBe(pqe.bind(null,n,i,t),[t]),n.flags|=2048,ZU(9,fqe.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=Fy(),e=wl.identifierPrefix;if(Ui){var r=mx,n=hx;r=(n&~(1<<32-ag(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=YU++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=$Gt++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},VGt={readContext:wh,useCallback:wqe,useContext:wh,useEffect:Lde,useImperativeHandle:vqe,useInsertionEffect:yqe,useLayoutEffect:bqe,useMemo:Sqe,useReducer:uce,useRef:gqe,useState:function(){return uce(XU)},useDebugValue:Fde,useDeferredValue:function(t){var e=Sh();return xqe(e,Xu.memoizedState,t)},useTransition:function(){var t=uce(XU)[0],e=Sh().memoizedState;return[t,e]},useMutableSource:lqe,useSyncExternalStore:cqe,useId:Cqe,unstable_isNewReconciler:!1},WGt={readContext:wh,useCallback:wqe,useContext:wh,useEffect:Lde,useImperativeHandle:vqe,useInsertionEffect:yqe,useLayoutEffect:bqe,useMemo:Sqe,useReducer:lce,useRef:gqe,useState:function(){return lce(XU)},useDebugValue:Fde,useDeferredValue:function(t){var e=Sh();return Xu===null?e.memoizedState=t:xqe(e,Xu.memoizedState,t)},useTransition:function(){var t=lce(XU)[0],e=Sh().memoizedState;return[t,e]},useMutableSource:lqe,useSyncExternalStore:cqe,useId:Cqe,unstable_isNewReconciler:!1};function SN(t,e){try{var r="",n=e;do r+=SJt(n),n=n.return;while(n);var o=r}catch(i){o=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function cce(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Wce(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var JGt=typeof WeakMap=="function"?WeakMap:Map;function Tqe(t,e,r){r=gx(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){aW||(aW=!0,rde=n),Wce(t,e)},r}function Mqe(t,e,r){r=gx(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var o=e.value;r.payload=function(){return n(o)},r.callback=function(){Wce(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Wce(t,e),typeof n!="function"&&(ME===null?ME=new Set([this]):ME.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function kBe(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new JGt;var o=new Set;n.set(e,o)}else o=n.get(e),o===void 0&&(o=new Set,n.set(e,o));o.has(r)||(o.add(r),t=sKt.bind(null,t,e,r),e.then(t,t))}function BBe(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function $Be(t,e,r,n,o){return t.mode&1?(t.flags|=65536,t.lanes=o,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=gx(-1,1),e.tag=2,TE(r,e,1))),r.lanes|=1),t)}var GGt=wx.ReactCurrentOwner,yf=!1;function Nd(t,e,r,n){e.child=t===null?sqe(e,null,r,n):vN(e,t.child,r,n)}function qBe(t,e,r,n,o){r=r.render;var i=e.ref;return mN(e,o),n=jde(t,e,r,n,i,o),r=Nde(),t!==null&&!yf?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,vx(t,e,o)):(Ui&&r&&Sde(e),e.flags|=1,Nd(t,e,n,o),e.child)}function UBe(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!Vde(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,Aqe(t,e,i,n,o)):(t=B9(r.type,null,n,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:HU,r(a,n)&&t.ref===e.ref)return vx(t,e,o)}return e.flags|=1,t=RE(i,n),t.ref=e.ref,t.return=e,e.child=t}function Aqe(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(HU(i,n)&&t.ref===e.ref)if(yf=!1,e.pendingProps=n=i,(t.lanes&o)!==0)t.flags&131072&&(yf=!0);else return e.lanes=t.lanes,vx(t,e,o)}return Jce(t,e,r,n,o)}function Rqe(t,e,r){var n=e.pendingProps,o=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ui(cN,pp),pp|=r;else{if(!(r&1073741824))return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ui(cN,pp),pp|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,ui(cN,pp),pp|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,ui(cN,pp),pp|=n;return Nd(t,e,o,r),e.child}function Iqe(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Jce(t,e,r,n,o){var i=_f(r)?VA:Xc.current;return i=bN(e,i),mN(e,o),r=jde(t,e,r,n,i,o),n=Nde(),t!==null&&!yf?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,vx(t,e,o)):(Ui&&n&&Sde(e),e.flags|=1,Nd(t,e,r,o),e.child)}function zBe(t,e,r,n,o){if(_f(r)){var i=!0;Y9(e)}else i=!1;if(mN(e,o),e.stateNode===null)L9(t,e),iqe(e,r,n),Vce(e,r,n,o),n=!0;else if(t===null){var a=e.stateNode,s=e.memoizedProps;a.props=s;var u=a.context,l=r.contextType;typeof l=="object"&&l!==null?l=wh(l):(l=_f(r)?VA:Xc.current,l=bN(e,l));var c=r.getDerivedStateFromProps,d=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==n||u!==l)&&jBe(e,a,n,l),_E=!1;var f=e.memoizedState;a.state=f,tW(e,n,a,o),u=e.memoizedState,s!==n||f!==u||bf.current||_E?(typeof c=="function"&&(Hce(e,r,c,n),u=e.memoizedState),(s=_E||DBe(e,r,s,n,f,u,l))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=u),a.props=n,a.state=u,a.context=l,n=s):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{a=e.stateNode,nqe(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:ng(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=wh(u):(u=_f(r)?VA:Xc.current,u=bN(e,u));var p=r.getDerivedStateFromProps;(c=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==d||f!==u)&&jBe(e,a,n,u),_E=!1,f=e.memoizedState,a.state=f,tW(e,n,a,o);var h=e.memoizedState;s!==d||f!==h||bf.current||_E?(typeof p=="function"&&(Hce(e,r,p,n),h=e.memoizedState),(l=_E||DBe(e,r,l,n,f,h,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,h,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,h,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=h),a.props=n,a.state=h,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return Gce(t,e,r,n,i,o)}function Gce(t,e,r,n,o,i){Iqe(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&TBe(e,r,!1),vx(t,e,i);n=e.stateNode,GGt.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=vN(e,t.child,null,i),e.child=vN(e,null,s,i)):Nd(t,e,s,i),e.memoizedState=n.state,o&&TBe(e,r,!0),e.child}function Dqe(t){var e=t.stateNode;e.pendingContext?PBe(t,e.pendingContext,e.pendingContext!==e.context):e.context&&PBe(t,e.context,!1),Ade(t,e.containerInfo)}function HBe(t,e,r,n,o){return _N(),Cde(o),e.flags|=256,Nd(t,e,r,n),e.child}var Kce={dehydrated:null,treeContext:null,retryLane:0};function Yce(t){return{baseLanes:t,cachePool:null,transitions:null}}function jqe(t,e,r){var n=e.pendingProps,o=aa.current,i=!1,a=(e.flags&128)!==0,s;if((s=a)||(s=t!==null&&t.memoizedState===null?!1:(o&2)!==0),s?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),ui(aa,o&1),t===null)return Uce(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=n.children,t=n.fallback,i?(n=e.mode,i=e.child,a={mode:"hidden",children:a},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=vW(a,n,0,null),t=HA(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Yce(r),e.memoizedState=Kce,t):kde(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return KGt(t,e,a,n,s,o,r);if(i){i=n.fallback,a=e.mode,o=t.child,s=o.sibling;var u={mode:"hidden",children:n.children};return!(a&1)&&e.child!==o?(n=e.child,n.childLanes=0,n.pendingProps=u,e.deletions=null):(n=RE(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=RE(s,i):(i=HA(i,a,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,a=t.child.memoizedState,a=a===null?Yce(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=Kce,n}return i=t.child,t=i.sibling,n=RE(i,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function kde(t,e){return e=vW({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function P9(t,e,r,n){return n!==null&&Cde(n),vN(e,t.child,null,r),t=kde(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function KGt(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=cce(Error(Oe(422))),P9(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=vW({mode:"visible",children:n.children},o,0,null),i=HA(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,e.mode&1&&vN(e,t.child,null,a),e.child.memoizedState=Yce(a),e.memoizedState=Kce,i);if(!(e.mode&1))return P9(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Oe(419)),n=cce(i,n,void 0),P9(t,e,a,n)}if(s=(a&t.childLanes)!==0,yf||s){if(n=wl,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:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,_x(t,o),sg(n,t,o,-1))}return Hde(),n=cce(Error(Oe(421))),P9(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=uKt.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,hp=PE(o.nextSibling),mp=e,Ui=!0,ig=null,t!==null&&(yh[bh++]=hx,yh[bh++]=mx,yh[bh++]=WA,hx=t.id,mx=t.overflow,WA=e),e=kde(e,n.children),e.flags|=4096,e)}function VBe(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),zce(t.return,e,r)}function dce(t,e,r,n,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function Nqe(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Nd(t,e,n.children,r),n=aa.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&VBe(t,r,e);else if(t.tag===19)VBe(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(ui(aa,n),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(r=e.child,o=null;r!==null;)t=r.alternate,t!==null&&rW(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),dce(e,!1,o,r,i);break;case"backwards":for(r=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&rW(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}dce(e,!0,r,null,i);break;case"together":dce(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function L9(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function vx(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),GA|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Oe(153));if(e.child!==null){for(t=e.child,r=RE(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=RE(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function YGt(t,e,r){switch(e.tag){case 3:Dqe(e),_N();break;case 5:uqe(e);break;case 1:_f(e.type)&&Y9(e);break;case 4:Ade(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;ui(Q9,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(ui(aa,aa.current&1),e.flags|=128,null):r&e.child.childLanes?jqe(t,e,r):(ui(aa,aa.current&1),t=vx(t,e,r),t!==null?t.sibling:null);ui(aa,aa.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return Nqe(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ui(aa,aa.current),n)break;return null;case 22:case 23:return e.lanes=0,Rqe(t,e,r)}return vx(t,e,r)}var Lqe,Xce,Fqe,kqe;Lqe=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Xce=function(){};Fqe=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,UA($y.current);var i=null;switch(r){case"input":o=_ce(t,o),n=_ce(t,n),i=[];break;case"select":o=ua({},o,{value:void 0}),n=ua({},n,{value:void 0}),i=[];break;case"textarea":o=Sce(t,o),n=Sce(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=G9)}Cce(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"&&(FU.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"&&(FU.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&vi("scroll",t),i||s===u||(i=[])):(i=i||[]).push(l,u))}r&&(i=i||[]).push("style",r);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};kqe=function(t,e,r,n){r!==n&&(e.flags|=4)};function wU(t,e){if(!Ui)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Kc(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function XGt(t,e,r){var n=e.pendingProps;switch(xde(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kc(e),null;case 1:return _f(e.type)&&K9(),Kc(e),null;case 3:return n=e.stateNode,wN(),wi(bf),wi(Xc),Ide(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(O9(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ig!==null&&(ide(ig),ig=null))),Xce(t,e),Kc(e),null;case 5:Rde(e);var o=UA(KU.current);if(r=e.type,t!==null&&e.stateNode!=null)Fqe(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Oe(166));return Kc(e),null}if(t=UA($y.current),O9(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[ky]=e,n[JU]=i,t=(e.mode&1)!==0,r){case"dialog":vi("cancel",n),vi("close",n);break;case"iframe":case"object":case"embed":vi("load",n);break;case"video":case"audio":for(o=0;o<PU.length;o++)vi(PU[o],n);break;case"source":vi("error",n);break;case"img":case"image":case"link":vi("error",n),vi("load",n);break;case"details":vi("toggle",n);break;case"input":Qke(n,i),vi("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},vi("invalid",n);break;case"textarea":tBe(n,i),vi("invalid",n)}Cce(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&&C9(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&C9(n.textContent,s,t),o=["children",""+s]):FU.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&vi("scroll",n)}switch(r){case"input":f9(n),eBe(n,i,!0);break;case"textarea":f9(n),rBe(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=G9)}n=o,e.updateQueue=n,n!==null&&(e.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=d$e(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[ky]=e,t[JU]=n,Lqe(t,e,!1,!1),e.stateNode=t;e:{switch(a=Oce(r,n),r){case"dialog":vi("cancel",t),vi("close",t),o=n;break;case"iframe":case"object":case"embed":vi("load",t),o=n;break;case"video":case"audio":for(o=0;o<PU.length;o++)vi(PU[o],t);o=n;break;case"source":vi("error",t),o=n;break;case"img":case"image":case"link":vi("error",t),vi("load",t),o=n;break;case"details":vi("toggle",t),o=n;break;case"input":Qke(t,n),o=_ce(t,n),vi("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=ua({},n,{value:void 0}),vi("invalid",t);break;case"textarea":tBe(t,n),o=Sce(t,n),vi("invalid",t);break;default:o=n}Cce(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?h$e(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&f$e(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&kU(t,u):typeof u=="number"&&kU(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(FU.hasOwnProperty(i)?u!=null&&i==="onScroll"&&vi("scroll",t):u!=null&&ude(t,i,u,a))}switch(r){case"input":f9(t),eBe(t,n,!1);break;case"textarea":f9(t),rBe(t);break;case"option":n.value!=null&&t.setAttribute("value",""+IE(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?dN(t,!!n.multiple,i,!1):n.defaultValue!=null&&dN(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=G9)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Kc(e),null;case 6:if(t&&e.stateNode!=null)kqe(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Oe(166));if(r=UA(KU.current),UA($y.current),O9(e)){if(n=e.stateNode,r=e.memoizedProps,n[ky]=e,(i=n.nodeValue!==r)&&(t=mp,t!==null))switch(t.tag){case 3:C9(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&C9(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[ky]=e,e.stateNode=n}return Kc(e),null;case 13:if(wi(aa),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ui&&hp!==null&&e.mode&1&&!(e.flags&128))tqe(),_N(),e.flags|=98560,i=!1;else if(i=O9(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(Oe(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Oe(317));i[ky]=e}else _N(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Kc(e),i=!1}else ig!==null&&(ide(ig),ig=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||aa.current&1?Zu===0&&(Zu=3):Hde())),e.updateQueue!==null&&(e.flags|=4),Kc(e),null);case 4:return wN(),Xce(t,e),t===null&&VU(e.stateNode.containerInfo),Kc(e),null;case 10:return Pde(e.type._context),Kc(e),null;case 17:return _f(e.type)&&K9(),Kc(e),null;case 19:if(wi(aa),i=e.memoizedState,i===null)return Kc(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)wU(i,!1);else{if(Zu!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=rW(t),a!==null){for(e.flags|=128,wU(i,!1),n=a.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,t=a.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return ui(aa,aa.current&1|2),e.child}t=t.sibling}i.tail!==null&&ts()>xN&&(e.flags|=128,n=!0,wU(i,!1),e.lanes=4194304)}else{if(!n)if(t=rW(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),wU(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ui)return Kc(e),null}else 2*ts()-i.renderingStartTime>xN&&r!==1073741824&&(e.flags|=128,n=!0,wU(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(r=i.last,r!==null?r.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=ts(),e.sibling=null,r=aa.current,ui(aa,n?r&1|2:r&1),e):(Kc(e),null);case 22:case 23:return zde(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?pp&1073741824&&(Kc(e),e.subtreeFlags&6&&(e.flags|=8192)):Kc(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function ZGt(t,e){switch(xde(e),e.tag){case 1:return _f(e.type)&&K9(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return wN(),wi(bf),wi(Xc),Ide(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Rde(e),null;case 13:if(wi(aa),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));_N()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return wi(aa),null;case 4:return wN(),null;case 10:return Pde(e.type._context),null;case 22:case 23:return zde(),null;case 24:return null;default:return null}}var T9=!1,Yc=!1,QGt=typeof WeakSet=="function"?WeakSet:Set,ot=null;function lN(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ka(t,e,n)}else r.current=null}function Zce(t,e,r){try{r()}catch(n){ka(t,e,n)}}var WBe=!1;function eKt(t,e){if(Nce=V9,t=U$e(),wde(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(s=a+o),d!==i||n!==0&&d.nodeType!==3||(u=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===r&&++l===o&&(s=a),f===i&&++c===n&&(u=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=s===-1||u===-1?null:{start:s,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(Lce={focusedElem:t,selectionRange:r},V9=!1,ot=e;ot!==null;)if(e=ot,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ot=t;else for(;ot!==null;){e=ot;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,v=h.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:ng(e.type,m),v);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(x){ka(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,ot=t;break}ot=e.return}return h=WBe,WBe=!1,h}function jU(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&Zce(e,r,i)}o=o.next}while(o!==n)}}function bW(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Qce(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Bqe(t){var e=t.alternate;e!==null&&(t.alternate=null,Bqe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ky],delete e[JU],delete e[Bce],delete e[LGt],delete e[FGt])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function $qe(t){return t.tag===5||t.tag===3||t.tag===4}function JBe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||$qe(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ede(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=G9));else if(n!==4&&(t=t.child,t!==null))for(ede(t,e,r),t=t.sibling;t!==null;)ede(t,e,r),t=t.sibling}function tde(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(tde(t,e,r),t=t.sibling;t!==null;)tde(t,e,r),t=t.sibling}var Yl=null,og=!1;function yE(t,e,r){for(r=r.child;r!==null;)qqe(t,e,r),r=r.sibling}function qqe(t,e,r){if(By&&typeof By.onCommitFiberUnmount=="function")try{By.onCommitFiberUnmount(cW,r)}catch{}switch(r.tag){case 5:Yc||lN(r,e);case 6:var n=Yl,o=og;Yl=null,yE(t,e,r),Yl=n,og=o,Yl!==null&&(og?(t=Yl,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Yl.removeChild(r.stateNode));break;case 18:Yl!==null&&(og?(t=Yl,r=r.stateNode,t.nodeType===8?oce(t.parentNode,r):t.nodeType===1&&oce(t,r),UU(t)):oce(Yl,r.stateNode));break;case 4:n=Yl,o=og,Yl=r.stateNode.containerInfo,og=!0,yE(t,e,r),Yl=n,og=o;break;case 0:case 11:case 14:case 15:if(!Yc&&(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||i&4)&&Zce(r,e,a),o=o.next}while(o!==n)}yE(t,e,r);break;case 1:if(!Yc&&(lN(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){ka(r,e,s)}yE(t,e,r);break;case 21:yE(t,e,r);break;case 22:r.mode&1?(Yc=(n=Yc)||r.memoizedState!==null,yE(t,e,r),Yc=n):yE(t,e,r);break;default:yE(t,e,r)}}function GBe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new QGt),e.forEach(function(n){var o=lKt.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function rg(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];try{var i=t,a=e,s=a;e:for(;s!==null;){switch(s.tag){case 5:Yl=s.stateNode,og=!1;break e;case 3:Yl=s.stateNode.containerInfo,og=!0;break e;case 4:Yl=s.stateNode.containerInfo,og=!0;break e}s=s.return}if(Yl===null)throw Error(Oe(160));qqe(i,a,o),Yl=null,og=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){ka(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Uqe(e,t),e=e.sibling}function Uqe(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(rg(e,t),Ly(t),n&4){try{jU(3,t,t.return),bW(3,t)}catch(m){ka(t,t.return,m)}try{jU(5,t,t.return)}catch(m){ka(t,t.return,m)}}break;case 1:rg(e,t),Ly(t),n&512&&r!==null&&lN(r,r.return);break;case 5:if(rg(e,t),Ly(t),n&512&&r!==null&&lN(r,r.return),t.flags&32){var o=t.stateNode;try{kU(o,"")}catch(m){ka(t,t.return,m)}}if(n&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,a=r!==null?r.memoizedProps:i,s=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&l$e(o,i),Oce(s,a);var l=Oce(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?h$e(o,d):c==="dangerouslySetInnerHTML"?f$e(o,d):c==="children"?kU(o,d):ude(o,c,d,l)}switch(s){case"input":vce(o,i);break;case"textarea":c$e(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?dN(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?dN(o,!!i.multiple,i.defaultValue,!0):dN(o,!!i.multiple,i.multiple?[]:"",!1))}o[JU]=i}catch(m){ka(t,t.return,m)}}break;case 6:if(rg(e,t),Ly(t),n&4){if(t.stateNode===null)throw Error(Oe(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){ka(t,t.return,m)}}break;case 3:if(rg(e,t),Ly(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{UU(e.containerInfo)}catch(m){ka(t,t.return,m)}break;case 4:rg(e,t),Ly(t);break;case 13:rg(e,t),Ly(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(qde=ts())),n&4&&GBe(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Yc=(l=Yc)||c,rg(e,t),Yc=l):rg(e,t),Ly(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(ot=t,c=t.child;c!==null;){for(d=ot=c;ot!==null;){switch(f=ot,p=f.child,f.tag){case 0:case 11:case 14:case 15:jU(4,f,f.return);break;case 1:lN(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){ka(n,r,m)}}break;case 5:lN(f,f.return);break;case 22:if(f.memoizedState!==null){YBe(d);continue}}p!==null?(p.return=f,ot=p):YBe(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(s=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,s.style.display=p$e("display",a))}catch(m){ka(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){ka(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:rg(e,t),Ly(t),n&4&&GBe(t);break;case 21:break;default:rg(e,t),Ly(t)}}function Ly(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if($qe(r)){var n=r;break e}r=r.return}throw Error(Oe(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(kU(o,""),n.flags&=-33);var i=JBe(t);tde(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=JBe(t);ede(t,s,a);break;default:throw Error(Oe(161))}}catch(u){ka(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function tKt(t,e,r){ot=t,zqe(t,e,r)}function zqe(t,e,r){for(var n=(t.mode&1)!==0;ot!==null;){var o=ot,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||T9;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Yc;s=T9;var l=Yc;if(T9=a,(Yc=u)&&!l)for(ot=o;ot!==null;)a=ot,u=a.child,a.tag===22&&a.memoizedState!==null?XBe(o):u!==null?(u.return=a,ot=u):XBe(o);for(;i!==null;)ot=i,zqe(i,e,r),i=i.sibling;ot=o,T9=s,Yc=l}KBe(t,e,r)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ot=i):KBe(t,e,r)}}function KBe(t){for(;ot!==null;){var e=ot;if(e.flags&8772){var r=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Yc||bW(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Yc)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:ng(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&IBe(e,i,n);break;case 3:var a=e.updateQueue;if(a!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}IBe(e,a,r)}break;case 5:var s=e.stateNode;if(r===null&&e.flags&4){r=s;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&UU(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Oe(163))}Yc||e.flags&512&&Qce(e)}catch(f){ka(e,e.return,f)}}if(e===t){ot=null;break}if(r=e.sibling,r!==null){r.return=e.return,ot=r;break}ot=e.return}}function YBe(t){for(;ot!==null;){var e=ot;if(e===t){ot=null;break}var r=e.sibling;if(r!==null){r.return=e.return,ot=r;break}ot=e.return}}function XBe(t){for(;ot!==null;){var e=ot;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{bW(4,e)}catch(u){ka(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){ka(e,o,u)}}var i=e.return;try{Qce(e)}catch(u){ka(e,i,u)}break;case 5:var a=e.return;try{Qce(e)}catch(u){ka(e,a,u)}}}catch(u){ka(e,e.return,u)}if(e===t){ot=null;break}var s=e.sibling;if(s!==null){s.return=e.return,ot=s;break}ot=e.return}}var rKt=Math.ceil,iW=wx.ReactCurrentDispatcher,Bde=wx.ReactCurrentOwner,vh=wx.ReactCurrentBatchConfig,kn=0,wl=null,bs=null,Xl=0,pp=0,cN=NE(0),Zu=0,QU=null,GA=0,_W=0,$de=0,NU=null,gf=null,qde=0,xN=1/0,fx=null,aW=!1,rde=null,ME=null,M9=!1,xE=null,sW=0,LU=0,nde=null,F9=-1,k9=0;function Ld(){return kn&6?ts():F9!==-1?F9:F9=ts()}function AE(t){return t.mode&1?kn&2&&Xl!==0?Xl&-Xl:BGt.transition!==null?(k9===0&&(k9=E$e()),k9):(t=ko,t!==0||(t=window.event,t=t===void 0?16:D$e(t.type)),t):1}function sg(t,e,r,n){if(50<LU)throw LU=0,nde=null,Error(Oe(185));ez(t,r,n),(!(kn&2)||t!==wl)&&(t===wl&&(!(kn&2)&&(_W|=r),Zu===4&&wE(t,Xl)),vf(t,n),r===1&&kn===0&&!(e.mode&1)&&(xN=ts()+500,mW&&LE()))}function vf(t,e){var r=t.callbackNode;qJt(t,e);var n=H9(t,t===wl?Xl:0);if(n===0)r!==null&&iBe(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&iBe(r),e===1)t.tag===0?kGt(ZBe.bind(null,t)):Z$e(ZBe.bind(null,t)),jGt(function(){!(kn&6)&&LE()}),r=null;else{switch(P$e(n)){case 1:r=pde;break;case 4:r=C$e;break;case 16:r=z9;break;case 536870912:r=O$e;break;default:r=z9}r=Xqe(r,Hqe.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function Hqe(t,e){if(F9=-1,k9=0,kn&6)throw Error(Oe(327));var r=t.callbackNode;if(gN()&&t.callbackNode!==r)return null;var n=H9(t,t===wl?Xl:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=uW(t,n);else{e=n;var o=kn;kn|=2;var i=Wqe();(wl!==t||Xl!==e)&&(fx=null,xN=ts()+500,zA(t,e));do try{iKt();break}catch(s){Vqe(t,s)}while(1);Ede(),iW.current=i,kn=o,bs!==null?e=0:(wl=null,Xl=0,e=Zu)}if(e!==0){if(e===2&&(o=Ace(t),o!==0&&(n=o,e=ode(t,o))),e===1)throw r=QU,zA(t,0),wE(t,n),vf(t,ts()),r;if(e===6)wE(t,n);else{if(o=t.current.alternate,!(n&30)&&!nKt(o)&&(e=uW(t,n),e===2&&(i=Ace(t),i!==0&&(n=i,e=ode(t,i))),e===1))throw r=QU,zA(t,0),wE(t,n),vf(t,ts()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(Oe(345));case 2:BA(t,gf,fx);break;case 3:if(wE(t,n),(n&130023424)===n&&(e=qde+500-ts(),10<e)){if(H9(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Ld(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=kce(BA.bind(null,t,gf,fx),e);break}BA(t,gf,fx);break;case 4:if(wE(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-ag(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=ts()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*rKt(n/1960))-n,10<n){t.timeoutHandle=kce(BA.bind(null,t,gf,fx),n);break}BA(t,gf,fx);break;case 5:BA(t,gf,fx);break;default:throw Error(Oe(329))}}}return vf(t,ts()),t.callbackNode===r?Hqe.bind(null,t):null}function ode(t,e){var r=NU;return t.current.memoizedState.isDehydrated&&(zA(t,e).flags|=256),t=uW(t,e),t!==2&&(e=gf,gf=r,e!==null&&ide(e)),t}function ide(t){gf===null?gf=t:gf.push.apply(gf,t)}function nKt(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var o=r[n],i=o.getSnapshot;o=o.value;try{if(!ug(i(),o))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function wE(t,e){for(e&=~$de,e&=~_W,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-ag(e),n=1<<r;t[r]=-1,e&=~n}}function ZBe(t){if(kn&6)throw Error(Oe(327));gN();var e=H9(t,0);if(!(e&1))return vf(t,ts()),null;var r=uW(t,e);if(t.tag!==0&&r===2){var n=Ace(t);n!==0&&(e=n,r=ode(t,n))}if(r===1)throw r=QU,zA(t,0),wE(t,e),vf(t,ts()),r;if(r===6)throw Error(Oe(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,BA(t,gf,fx),vf(t,ts()),null}function Ude(t,e){var r=kn;kn|=1;try{return t(e)}finally{kn=r,kn===0&&(xN=ts()+500,mW&&LE())}}function KA(t){xE!==null&&xE.tag===0&&!(kn&6)&&gN();var e=kn;kn|=1;var r=vh.transition,n=ko;try{if(vh.transition=null,ko=1,t)return t()}finally{ko=n,vh.transition=r,kn=e,!(kn&6)&&LE()}}function zde(){pp=cN.current,wi(cN)}function zA(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,DGt(r)),bs!==null)for(r=bs.return;r!==null;){var n=r;switch(xde(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&K9();break;case 3:wN(),wi(bf),wi(Xc),Ide();break;case 5:Rde(n);break;case 4:wN();break;case 13:wi(aa);break;case 19:wi(aa);break;case 10:Pde(n.type._context);break;case 22:case 23:zde()}r=r.return}if(wl=t,bs=t=RE(t.current,null),Xl=pp=e,Zu=0,QU=null,$de=_W=GA=0,gf=NU=null,qA!==null){for(e=0;e<qA.length;e++)if(r=qA[e],n=r.interleaved,n!==null){r.interleaved=null;var o=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=o,n.next=a}r.pending=n}qA=null}return t}function Vqe(t,e){do{var r=bs;try{if(Ede(),j9.current=oW,nW){for(var n=sa.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}nW=!1}if(JA=0,vl=Xu=sa=null,DU=!1,YU=0,Bde.current=null,r===null||r.return===null){Zu=1,QU=e,bs=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Xl,s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=s,d=c.tag;if(!(c.mode&1)&&(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=BBe(a);if(p!==null){p.flags&=-257,$Be(p,a,s,i,e),p.mode&1&&kBe(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if(!(e&1)){kBe(i,l,e),Hde();break e}u=Error(Oe(426))}}else if(Ui&&s.mode&1){var v=BBe(a);if(v!==null){!(v.flags&65536)&&(v.flags|=256),$Be(v,a,s,i,e),Cde(SN(u,s));break e}}i=u=SN(u,s),Zu!==4&&(Zu=2),NU===null?NU=[i]:NU.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=Tqe(i,u,e);RBe(i,g);break e;case 1:s=u;var _=i.type,S=i.stateNode;if(!(i.flags&128)&&(typeof _.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(ME===null||!ME.has(S)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=Mqe(i,s,e);RBe(i,x);break e}}i=i.return}while(i!==null)}Gqe(r)}catch(O){e=O,bs===r&&r!==null&&(bs=r=r.return);continue}break}while(1)}function Wqe(){var t=iW.current;return iW.current=oW,t===null?oW:t}function Hde(){(Zu===0||Zu===3||Zu===2)&&(Zu=4),wl===null||!(GA&268435455)&&!(_W&268435455)||wE(wl,Xl)}function uW(t,e){var r=kn;kn|=2;var n=Wqe();(wl!==t||Xl!==e)&&(fx=null,zA(t,e));do try{oKt();break}catch(o){Vqe(t,o)}while(1);if(Ede(),kn=r,iW.current=n,bs!==null)throw Error(Oe(261));return wl=null,Xl=0,Zu}function oKt(){for(;bs!==null;)Jqe(bs)}function iKt(){for(;bs!==null&&!IJt();)Jqe(bs)}function Jqe(t){var e=Yqe(t.alternate,t,pp);t.memoizedProps=t.pendingProps,e===null?Gqe(t):bs=e,Bde.current=null}function Gqe(t){var e=t;do{var r=e.alternate;if(t=e.return,e.flags&32768){if(r=ZGt(r,e),r!==null){r.flags&=32767,bs=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Zu=6,bs=null;return}}else if(r=XGt(r,e,pp),r!==null){bs=r;return}if(e=e.sibling,e!==null){bs=e;return}bs=e=t}while(e!==null);Zu===0&&(Zu=5)}function BA(t,e,r){var n=ko,o=vh.transition;try{vh.transition=null,ko=1,aKt(t,e,r,n)}finally{vh.transition=o,ko=n}return null}function aKt(t,e,r,n){do gN();while(xE!==null);if(kn&6)throw Error(Oe(327));r=t.finishedWork;var o=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(Oe(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(UJt(t,i),t===wl&&(bs=wl=null,Xl=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||M9||(M9=!0,Xqe(z9,function(){return gN(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=vh.transition,vh.transition=null;var a=ko;ko=1;var s=kn;kn|=4,Bde.current=null,eKt(t,r),Uqe(r,t),TGt(Lce),V9=!!Nce,Lce=Nce=null,t.current=r,tKt(r,t,o),DJt(),kn=s,ko=a,vh.transition=i}else t.current=r;if(M9&&(M9=!1,xE=t,sW=o),i=t.pendingLanes,i===0&&(ME=null),LJt(r.stateNode,n),vf(t,ts()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)o=e[r],n(o.value,{componentStack:o.stack,digest:o.digest});if(aW)throw aW=!1,t=rde,rde=null,t;return sW&1&&t.tag!==0&&gN(),i=t.pendingLanes,i&1?t===nde?LU++:(LU=0,nde=t):LU=0,LE(),null}function gN(){if(xE!==null){var t=P$e(sW),e=vh.transition,r=ko;try{if(vh.transition=null,ko=16>t?16:t,xE===null)var n=!1;else{if(t=xE,xE=null,sW=0,kn&6)throw Error(Oe(331));var o=kn;for(kn|=4,ot=t.current;ot!==null;){var i=ot,a=i.child;if(ot.flags&16){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(ot=l;ot!==null;){var c=ot;switch(c.tag){case 0:case 11:case 15:jU(8,c,i)}var d=c.child;if(d!==null)d.return=c,ot=d;else for(;ot!==null;){c=ot;var f=c.sibling,p=c.return;if(Bqe(c),c===l){ot=null;break}if(f!==null){f.return=p,ot=f;break}ot=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==null)}}ot=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,ot=a;else e:for(;ot!==null;){if(i=ot,i.flags&2048)switch(i.tag){case 0:case 11:case 15:jU(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,ot=g;break e}ot=i.return}}var _=t.current;for(ot=_;ot!==null;){a=ot;var S=a.child;if(a.subtreeFlags&2064&&S!==null)S.return=a,ot=S;else e:for(a=_;ot!==null;){if(s=ot,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:bW(9,s)}}catch(O){ka(s,s.return,O)}if(s===a){ot=null;break e}var x=s.sibling;if(x!==null){x.return=s.return,ot=x;break e}ot=s.return}}if(kn=o,LE(),By&&typeof By.onPostCommitFiberRoot=="function")try{By.onPostCommitFiberRoot(cW,t)}catch{}n=!0}return n}finally{ko=r,vh.transition=e}}return!1}function QBe(t,e,r){e=SN(r,e),e=Tqe(t,e,1),t=TE(t,e,1),e=Ld(),t!==null&&(ez(t,1,e),vf(t,e))}function ka(t,e,r){if(t.tag===3)QBe(t,t,r);else for(;e!==null;){if(e.tag===3){QBe(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ME===null||!ME.has(n))){t=SN(r,t),t=Mqe(e,t,1),e=TE(e,t,1),t=Ld(),e!==null&&(ez(e,1,t),vf(e,t));break}}e=e.return}}function sKt(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Ld(),t.pingedLanes|=t.suspendedLanes&r,wl===t&&(Xl&r)===r&&(Zu===4||Zu===3&&(Xl&130023424)===Xl&&500>ts()-qde?zA(t,0):$de|=r),vf(t,e)}function Kqe(t,e){e===0&&(t.mode&1?(e=m9,m9<<=1,!(m9&130023424)&&(m9=4194304)):e=1);var r=Ld();t=_x(t,e),t!==null&&(ez(t,e,r),vf(t,r))}function uKt(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Kqe(t,r)}function lKt(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,o=t.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Oe(314))}n!==null&&n.delete(e),Kqe(t,r)}var Yqe;Yqe=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||bf.current)yf=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return yf=!1,YGt(t,e,r);yf=!!(t.flags&131072)}else yf=!1,Ui&&e.flags&1048576&&Q$e(e,Z9,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;L9(t,e),t=e.pendingProps;var o=bN(e,Xc.current);mN(e,r),o=jde(null,e,n,t,o,r);var i=Nde();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,_f(n)?(i=!0,Y9(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Mde(e),o.updater=gW,e.stateNode=o,o._reactInternals=e,Vce(e,n,t,r),e=Gce(null,e,n,!0,i,r)):(e.tag=0,Ui&&i&&Sde(e),Nd(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(L9(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=dKt(n),t=ng(n,t),o){case 0:e=Jce(null,e,n,t,r);break e;case 1:e=zBe(null,e,n,t,r);break e;case 11:e=qBe(null,e,n,t,r);break e;case 14:e=UBe(null,e,n,ng(n.type,t),r);break e}throw Error(Oe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ng(n,o),Jce(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ng(n,o),zBe(t,e,n,o,r);case 3:e:{if(Dqe(e),t===null)throw Error(Oe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,nqe(t,e),tW(e,n,null,r);var a=e.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=SN(Error(Oe(423)),e),e=HBe(t,e,n,r,o);break e}else if(n!==o){o=SN(Error(Oe(424)),e),e=HBe(t,e,n,r,o);break e}else for(hp=PE(e.stateNode.containerInfo.firstChild),mp=e,Ui=!0,ig=null,r=sqe(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(_N(),n===o){e=vx(t,e,r);break e}Nd(t,e,n,r)}e=e.child}return e;case 5:return uqe(e),t===null&&Uce(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,Fce(n,o)?a=null:i!==null&&Fce(n,i)&&(e.flags|=32),Iqe(t,e),Nd(t,e,a,r),e.child;case 6:return t===null&&Uce(e),null;case 13:return jqe(t,e,r);case 4:return Ade(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=vN(e,null,n,r):Nd(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ng(n,o),qBe(t,e,n,o,r);case 7:return Nd(t,e,e.pendingProps,r),e.child;case 8:return Nd(t,e,e.pendingProps.children,r),e.child;case 12:return Nd(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,o=e.pendingProps,i=e.memoizedProps,a=o.value,ui(Q9,n._currentValue),n._currentValue=a,i!==null)if(ug(i.value,a)){if(i.children===o.children&&!bf.current){e=vx(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var u=s.firstContext;u!==null;){if(u.context===n){if(i.tag===1){u=gx(-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),zce(i.return,r,e),s.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Oe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),zce(a,r,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Nd(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,mN(e,r),o=wh(o),n=n(o),e.flags|=1,Nd(t,e,n,r),e.child;case 14:return n=e.type,o=ng(n,e.pendingProps),o=ng(n.type,o),UBe(t,e,n,o,r);case 15:return Aqe(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ng(n,o),L9(t,e),e.tag=1,_f(n)?(t=!0,Y9(e)):t=!1,mN(e,r),iqe(e,n,o),Vce(e,n,o,r),Gce(null,e,n,!0,t,r);case 19:return Nqe(t,e,r);case 22:return Rqe(t,e,r)}throw Error(Oe(156,e.tag))};function Xqe(t,e){return x$e(t,e)}function cKt(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _h(t,e,r,n){return new cKt(t,e,r,n)}function Vde(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dKt(t){if(typeof t=="function")return Vde(t)?1:0;if(t!=null){if(t=t.$$typeof,t===cde)return 11;if(t===dde)return 14}return 2}function RE(t,e){var r=t.alternate;return r===null?(r=_h(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function B9(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")Vde(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case eN:return HA(r.children,o,i,e);case lde:a=8,o|=8;break;case mce:return t=_h(12,r,e,o|2),t.elementType=mce,t.lanes=i,t;case gce:return t=_h(13,r,e,o),t.elementType=gce,t.lanes=i,t;case yce:return t=_h(19,r,e,o),t.elementType=yce,t.lanes=i,t;case a$e:return vW(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case o$e:a=10;break e;case i$e:a=9;break e;case cde:a=11;break e;case dde:a=14;break e;case bE:a=16,n=null;break e}throw Error(Oe(130,t==null?t:typeof t,""))}return e=_h(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function HA(t,e,r,n){return t=_h(7,t,n,e),t.lanes=r,t}function vW(t,e,r,n){return t=_h(22,t,n,e),t.elementType=a$e,t.lanes=r,t.stateNode={isHidden:!1},t}function fce(t,e,r){return t=_h(6,t,null,e),t.lanes=r,t}function pce(t,e,r){return e=_h(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function fKt(t,e,r,n,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yle(0),this.expirationTimes=Yle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yle(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Wde(t,e,r,n,o,i,a,s,u){return t=new fKt(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=_h(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mde(i),t}function pKt(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Qj,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Zqe(t){if(!t)return DE;t=t._reactInternals;e:{if(XA(t)!==t||t.tag!==1)throw Error(Oe(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(_f(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Oe(171))}if(t.tag===1){var r=t.type;if(_f(r))return X$e(t,r,e)}return e}function Qqe(t,e,r,n,o,i,a,s,u){return t=Wde(r,n,!0,t,o,i,a,s,u),t.context=Zqe(null),r=t.current,n=Ld(),o=AE(r),i=gx(n,o),i.callback=e??null,TE(r,i,o),t.current.lanes=o,ez(t,o,n),vf(t,n),t}function wW(t,e,r,n){var o=e.current,i=Ld(),a=AE(o);return r=Zqe(r),e.context===null?e.context=r:e.pendingContext=r,e=gx(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=TE(o,e,a),t!==null&&(sg(t,o,a,i),D9(t,o,a)),a}function lW(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function e$e(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function Jde(t,e){e$e(t,e),(t=t.alternate)&&e$e(t,e)}function hKt(){return null}var eUe=typeof reportError=="function"?reportError:function(t){console.error(t)};function Gde(t){this._internalRoot=t}SW.prototype.render=Gde.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Oe(409));wW(t,e,null,null)};SW.prototype.unmount=Gde.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;KA(function(){wW(null,t,null,null)}),e[bx]=null}};function SW(t){this._internalRoot=t}SW.prototype.unstable_scheduleHydration=function(t){if(t){var e=A$e();t={blockedOn:null,target:t,priority:e};for(var r=0;r<vE.length&&e!==0&&e<vE[r].priority;r++);vE.splice(r,0,t),r===0&&I$e(t)}};function Kde(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function xW(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function t$e(){}function mKt(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=lW(a);i.call(l)}}var a=Qqe(e,n,t,0,null,!1,!1,"",t$e);return t._reactRootContainer=a,t[bx]=a.current,VU(t.nodeType===8?t.parentNode:t),KA(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=lW(u);s.call(l)}}var u=Wde(t,0,!1,null,null,!1,!1,"",t$e);return t._reactRootContainer=u,t[bx]=u.current,VU(t.nodeType===8?t.parentNode:t),KA(function(){wW(e,u,r,n)}),u}function CW(t,e,r,n,o){var i=r._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var s=o;o=function(){var u=lW(a);s.call(u)}}wW(e,a,t,o)}else a=mKt(r,e,t,o,n);return lW(a)}T$e=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=EU(e.pendingLanes);r!==0&&(hde(e,r|1),vf(e,ts()),!(kn&6)&&(xN=ts()+500,LE()))}break;case 13:KA(function(){var n=_x(t,1);if(n!==null){var o=Ld();sg(n,t,1,o)}}),Jde(t,1)}};mde=function(t){if(t.tag===13){var e=_x(t,134217728);if(e!==null){var r=Ld();sg(e,t,134217728,r)}Jde(t,134217728)}};M$e=function(t){if(t.tag===13){var e=AE(t),r=_x(t,e);if(r!==null){var n=Ld();sg(r,t,e,n)}Jde(t,e)}};A$e=function(){return ko};R$e=function(t,e){var r=ko;try{return ko=t,e()}finally{ko=r}};Pce=function(t,e,r){switch(e){case"input":if(vce(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var o=hW(n);if(!o)throw Error(Oe(90));u$e(n),vce(n,o)}}}break;case"textarea":c$e(t,r);break;case"select":e=r.value,e!=null&&dN(t,!!r.multiple,e,!1)}};y$e=Ude;b$e=KA;var gKt={usingClientEntryPoint:!1,Events:[rz,oN,hW,m$e,g$e,Ude]},SU={findFiberByHostInstance:$A,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},yKt={bundleType:SU.bundleType,version:SU.version,rendererPackageName:SU.rendererPackageName,rendererConfig:SU.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:wx.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=w$e(t),t===null?null:t.stateNode},findFiberByHostInstance:SU.findFiberByHostInstance||hKt,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(xU=__REACT_DEVTOOLS_GLOBAL_HOOK__,!xU.isDisabled&&xU.supportsFiber))try{cW=xU.inject(yKt),By=xU}catch{}var xU;bp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gKt;bp.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Kde(e))throw Error(Oe(200));return pKt(t,e,null,r)};bp.createRoot=function(t,e){if(!Kde(t))throw Error(Oe(299));var r=!1,n="",o=eUe;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Wde(t,1,!1,null,null,r,!1,n,o),t[bx]=e.current,VU(t.nodeType===8?t.parentNode:t),new Gde(e)};bp.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Oe(188)):(t=Object.keys(t).join(","),Error(Oe(268,t)));return t=w$e(e),t=t===null?null:t.stateNode,t};bp.flushSync=function(t){return KA(t)};bp.hydrate=function(t,e,r){if(!xW(e))throw Error(Oe(200));return CW(null,t,e,!0,r)};bp.hydrateRoot=function(t,e,r){if(!Kde(t))throw Error(Oe(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=eUe;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=Qqe(e,null,t,1,r??null,o,!1,i,a),t[bx]=e.current,VU(t),n)for(t=0;t<n.length;t++)r=n[t],o=r._getVersion,o=o(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,o]:e.mutableSourceEagerHydrationData.push(r,o);return new SW(e)};bp.render=function(t,e,r){if(!xW(e))throw Error(Oe(200));return CW(null,t,e,!1,r)};bp.unmountComponentAtNode=function(t){if(!xW(t))throw Error(Oe(40));return t._reactRootContainer?(KA(function(){CW(null,null,t,!1,function(){t._reactRootContainer=null,t[bx]=null})}),!0):!1};bp.unstable_batchedUpdates=Ude;bp.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!xW(r))throw Error(Oe(200));if(t==null||t._reactInternals===void 0)throw Error(Oe(38));return CW(t,e,r,!1,n)};bp.version="18.2.0-next-9e3b772b8-20220608"});var _s=b((dEn,nUe)=>{"use strict";function rUe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rUe)}catch(t){console.error(t)}}rUe(),nUe.exports=tUe()});var lg=b(Yde=>{"use strict";var oUe=_s();Yde.createRoot=oUe.createRoot,Yde.hydrateRoot=oUe.hydrateRoot;var fEn});var sUe=b(OW=>{"use strict";var _Kt=Z(),vKt=Symbol.for("react.element"),wKt=Symbol.for("react.fragment"),SKt=Object.prototype.hasOwnProperty,xKt=_Kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,CKt={key:!0,ref:!0,__self:!0,__source:!0};function aUe(t,e,r){var n,o={},i=null,a=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(n in e)SKt.call(e,n)&&!CKt.hasOwnProperty(n)&&(o[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)o[n]===void 0&&(o[n]=e[n]);return{$$typeof:vKt,type:t,key:i,ref:a,props:o,_owner:xKt.current}}OW.Fragment=wKt;OW.jsx=aUe;OW.jsxs=aUe});var dt=b((gEn,uUe)=>{"use strict";uUe.exports=sUe()});var PUe=b(RW=>{"use strict";Object.defineProperty(RW,"__esModule",{value:!0});RW.V2ChatStreamRequestCitationMode=void 0;RW.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var TUe=b(IW=>{"use strict";Object.defineProperty(IW,"__esModule",{value:!0});IW.V2ChatRequestCitationMode=void 0;IW.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var AUe=b(MUe=>{"use strict";Object.defineProperty(MUe,"__esModule",{value:!0})});var IUe=b(RUe=>{"use strict";Object.defineProperty(RUe,"__esModule",{value:!0})});var jUe=b(DUe=>{"use strict";Object.defineProperty(DUe,"__esModule",{value:!0})});var LUe=b(NUe=>{"use strict";Object.defineProperty(NUe,"__esModule",{value:!0})});var kUe=b(FUe=>{"use strict";Object.defineProperty(FUe,"__esModule",{value:!0})});var $Ue=b(BUe=>{"use strict";Object.defineProperty(BUe,"__esModule",{value:!0})});var UUe=b(qUe=>{"use strict";Object.defineProperty(qUe,"__esModule",{value:!0})});var HUe=b(zUe=>{"use strict";Object.defineProperty(zUe,"__esModule",{value:!0})});var WUe=b(VUe=>{"use strict";Object.defineProperty(VUe,"__esModule",{value:!0})});var GUe=b(JUe=>{"use strict";Object.defineProperty(JUe,"__esModule",{value:!0})});var YUe=b(KUe=>{"use strict";Object.defineProperty(KUe,"__esModule",{value:!0})});var ZUe=b(XUe=>{"use strict";Object.defineProperty(XUe,"__esModule",{value:!0})});var eze=b(QUe=>{"use strict";Object.defineProperty(QUe,"__esModule",{value:!0})});var rze=b(tze=>{"use strict";Object.defineProperty(tze,"__esModule",{value:!0})});var oze=b(nze=>{"use strict";Object.defineProperty(nze,"__esModule",{value:!0})});var aze=b(ize=>{"use strict";Object.defineProperty(ize,"__esModule",{value:!0})});var uze=b(sze=>{"use strict";Object.defineProperty(sze,"__esModule",{value:!0})});var cze=b(lze=>{"use strict";Object.defineProperty(lze,"__esModule",{value:!0})});var fze=b(dze=>{"use strict";Object.defineProperty(dze,"__esModule",{value:!0})});var hze=b(pze=>{"use strict";Object.defineProperty(pze,"__esModule",{value:!0})});var gze=b(mze=>{"use strict";Object.defineProperty(mze,"__esModule",{value:!0})});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 wze=b(DW=>{"use strict";Object.defineProperty(DW,"__esModule",{value:!0});DW.ChatFinishReason=void 0;DW.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var xze=b(Sze=>{"use strict";Object.defineProperty(Sze,"__esModule",{value:!0})});var Oze=b(Cze=>{"use strict";Object.defineProperty(Cze,"__esModule",{value:!0})});var Pze=b(Eze=>{"use strict";Object.defineProperty(Eze,"__esModule",{value:!0})});var Mze=b(Tze=>{"use strict";Object.defineProperty(Tze,"__esModule",{value:!0})});var Rze=b(Aze=>{"use strict";Object.defineProperty(Aze,"__esModule",{value:!0})});var Dze=b(Ize=>{"use strict";Object.defineProperty(Ize,"__esModule",{value:!0})});var Nze=b(jze=>{"use strict";Object.defineProperty(jze,"__esModule",{value:!0})});var Fze=b(Lze=>{"use strict";Object.defineProperty(Lze,"__esModule",{value:!0})});var Bze=b(kze=>{"use strict";Object.defineProperty(kze,"__esModule",{value:!0})});var qze=b($ze=>{"use strict";Object.defineProperty($ze,"__esModule",{value:!0})});var zze=b(Uze=>{"use strict";Object.defineProperty(Uze,"__esModule",{value:!0})});var Vze=b(Hze=>{"use strict";Object.defineProperty(Hze,"__esModule",{value:!0})});var Jze=b(Wze=>{"use strict";Object.defineProperty(Wze,"__esModule",{value:!0})});var Kze=b(Gze=>{"use strict";Object.defineProperty(Gze,"__esModule",{value:!0})});var Xze=b(Yze=>{"use strict";Object.defineProperty(Yze,"__esModule",{value:!0})});var Qze=b(Zze=>{"use strict";Object.defineProperty(Zze,"__esModule",{value:!0})});var t2e=b(e2e=>{"use strict";Object.defineProperty(e2e,"__esModule",{value:!0})});var n2e=b(r2e=>{"use strict";Object.defineProperty(r2e,"__esModule",{value:!0})});var i2e=b(o2e=>{"use strict";Object.defineProperty(o2e,"__esModule",{value:!0})});var s2e=b(a2e=>{"use strict";Object.defineProperty(a2e,"__esModule",{value:!0})});var l2e=b(u2e=>{"use strict";Object.defineProperty(u2e,"__esModule",{value:!0})});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 R2e=b(A2e=>{"use strict";Object.defineProperty(A2e,"__esModule",{value:!0})});var D2e=b(I2e=>{"use strict";Object.defineProperty(I2e,"__esModule",{value:!0})});var nfe=b(ut=>{"use strict";var c7t=ut&&ut.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bt=ut&&ut.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&c7t(e,t,r)};Object.defineProperty(ut,"__esModule",{value:!0});bt(PUe(),ut);bt(TUe(),ut);bt(AUe(),ut);bt(IUe(),ut);bt(jUe(),ut);bt(LUe(),ut);bt(kUe(),ut);bt($Ue(),ut);bt(UUe(),ut);bt(HUe(),ut);bt(WUe(),ut);bt(GUe(),ut);bt(YUe(),ut);bt(ZUe(),ut);bt(eze(),ut);bt(rze(),ut);bt(oze(),ut);bt(aze(),ut);bt(uze(),ut);bt(cze(),ut);bt(fze(),ut);bt(hze(),ut);bt(gze(),ut);bt(bze(),ut);bt(vze(),ut);bt(wze(),ut);bt(xze(),ut);bt(Oze(),ut);bt(Pze(),ut);bt(Mze(),ut);bt(Rze(),ut);bt(Dze(),ut);bt(Nze(),ut);bt(Fze(),ut);bt(Bze(),ut);bt(qze(),ut);bt(zze(),ut);bt(Vze(),ut);bt(Jze(),ut);bt(Kze(),ut);bt(Xze(),ut);bt(Qze(),ut);bt(t2e(),ut);bt(n2e(),ut);bt(i2e(),ut);bt(s2e(),ut);bt(l2e(),ut);bt(d2e(),ut);bt(p2e(),ut);bt(m2e(),ut);bt(y2e(),ut);bt(_2e(),ut);bt(w2e(),ut);bt(x2e(),ut);bt(O2e(),ut);bt(P2e(),ut);bt(M2e(),ut);bt(R2e(),ut);bt(D2e(),ut)});var ofe=b(j2e=>{"use strict";Object.defineProperty(j2e,"__esModule",{value:!0})});var N2e=b(uR=>{"use strict";var d7t=uR&&uR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f7t=uR&&uR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d7t(e,t,r)};Object.defineProperty(uR,"__esModule",{value:!0});f7t(ofe(),uR)});var F2e=b(zE=>{"use strict";var p7t=zE&&zE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L2e=zE&&zE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p7t(e,t,r)};Object.defineProperty(zE,"__esModule",{value:!0});L2e(nfe(),zE);L2e(N2e(),zE)});var k2e=b(jW=>{"use strict";Object.defineProperty(jW,"__esModule",{value:!0});jW.CreateEmbedJobRequestTruncate=void 0;jW.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var ife=b(lR=>{"use strict";var h7t=lR&&lR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m7t=lR&&lR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h7t(e,t,r)};Object.defineProperty(lR,"__esModule",{value:!0});m7t(k2e(),lR)});var afe=b(B2e=>{"use strict";Object.defineProperty(B2e,"__esModule",{value:!0})});var $2e=b(cR=>{"use strict";var g7t=cR&&cR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y7t=cR&&cR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&g7t(e,t,r)};Object.defineProperty(cR,"__esModule",{value:!0});y7t(afe(),cR)});var U2e=b(HE=>{"use strict";var b7t=HE&&HE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q2e=HE&&HE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&b7t(e,t,r)};Object.defineProperty(HE,"__esModule",{value:!0});q2e(ife(),HE);q2e($2e(),HE)});var H2e=b(z2e=>{"use strict";Object.defineProperty(z2e,"__esModule",{value:!0})});var W2e=b(V2e=>{"use strict";Object.defineProperty(V2e,"__esModule",{value:!0})});var G2e=b(J2e=>{"use strict";Object.defineProperty(J2e,"__esModule",{value:!0})});var Y2e=b(K2e=>{"use strict";Object.defineProperty(K2e,"__esModule",{value:!0})});var Z2e=b(X2e=>{"use strict";Object.defineProperty(X2e,"__esModule",{value:!0})});var sfe=b(fg=>{"use strict";var _7t=fg&&fg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Az=fg&&fg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_7t(e,t,r)};Object.defineProperty(fg,"__esModule",{value:!0});Az(H2e(),fg);Az(W2e(),fg);Az(G2e(),fg);Az(Y2e(),fg);Az(Z2e(),fg)});var ufe=b(Q2e=>{"use strict";Object.defineProperty(Q2e,"__esModule",{value:!0})});var e4e=b(dR=>{"use strict";var v7t=dR&&dR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w7t=dR&&dR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v7t(e,t,r)};Object.defineProperty(dR,"__esModule",{value:!0});w7t(ufe(),dR)});var r4e=b(VE=>{"use strict";var S7t=VE&&VE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t4e=VE&&VE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&S7t(e,t,r)};Object.defineProperty(VE,"__esModule",{value:!0});t4e(sfe(),VE);t4e(e4e(),VE)});var n4e=b(NW=>{"use strict";Object.defineProperty(NW,"__esModule",{value:!0});NW.BaseType=void 0;NW.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var o4e=b(LW=>{"use strict";Object.defineProperty(LW,"__esModule",{value:!0});LW.Strategy=void 0;LW.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var a4e=b(i4e=>{"use strict";Object.defineProperty(i4e,"__esModule",{value:!0})});var u4e=b(s4e=>{"use strict";Object.defineProperty(s4e,"__esModule",{value:!0})});var c4e=b(l4e=>{"use strict";Object.defineProperty(l4e,"__esModule",{value:!0})});var f4e=b(d4e=>{"use strict";Object.defineProperty(d4e,"__esModule",{value:!0})});var p4e=b(FW=>{"use strict";Object.defineProperty(FW,"__esModule",{value:!0});FW.Status=void 0;FW.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 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 x4e=b(S4e=>{"use strict";Object.defineProperty(S4e,"__esModule",{value:!0})});var O4e=b(C4e=>{"use strict";Object.defineProperty(C4e,"__esModule",{value:!0})});var P4e=b(E4e=>{"use strict";Object.defineProperty(E4e,"__esModule",{value:!0})});var M4e=b(T4e=>{"use strict";Object.defineProperty(T4e,"__esModule",{value:!0})});var R4e=b(A4e=>{"use strict";Object.defineProperty(A4e,"__esModule",{value:!0})});var D4e=b(I4e=>{"use strict";Object.defineProperty(I4e,"__esModule",{value:!0})});var lfe=b(la=>{"use strict";var x7t=la&&la.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ec=la&&la.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x7t(e,t,r)};Object.defineProperty(la,"__esModule",{value:!0});ec(n4e(),la);ec(o4e(),la);ec(a4e(),la);ec(u4e(),la);ec(c4e(),la);ec(f4e(),la);ec(p4e(),la);ec(m4e(),la);ec(y4e(),la);ec(_4e(),la);ec(w4e(),la);ec(x4e(),la);ec(O4e(),la);ec(P4e(),la);ec(M4e(),la);ec(R4e(),la);ec(D4e(),la)});var j4e=b(fR=>{"use strict";var C7t=fR&&fR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O7t=fR&&fR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&C7t(e,t,r)};Object.defineProperty(fR,"__esModule",{value:!0});O7t(lfe(),fR)});var L4e=b(_p=>{"use strict";var N4e=_p&&_p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E7t=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P7t=_p&&_p.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N4e(e,t,r);return E7t(e,t),e},T7t=_p&&_p.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N4e(e,t,r)};Object.defineProperty(_p,"__esModule",{value:!0});_p.finetuning=void 0;_p.finetuning=P7t(j4e());T7t(lfe(),_p)});var cfe=b(F4e=>{"use strict";Object.defineProperty(F4e,"__esModule",{value:!0})});var k4e=b(pR=>{"use strict";var M7t=pR&&pR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A7t=pR&&pR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M7t(e,t,r)};Object.defineProperty(pR,"__esModule",{value:!0});A7t(cfe(),pR)});var $4e=b(WE=>{"use strict";var R7t=WE&&WE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B4e=WE&&WE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&R7t(e,t,r)};Object.defineProperty(WE,"__esModule",{value:!0});B4e(L4e(),WE);B4e(k4e(),WE)});var dfe=b(q4e=>{"use strict";Object.defineProperty(q4e,"__esModule",{value:!0})});var U4e=b(hR=>{"use strict";var I7t=hR&&hR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D7t=hR&&hR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&I7t(e,t,r)};Object.defineProperty(hR,"__esModule",{value:!0});D7t(dfe(),hR)});var z4e=b(mR=>{"use strict";var j7t=mR&&mR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N7t=mR&&mR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j7t(e,t,r)};Object.defineProperty(mR,"__esModule",{value:!0});N7t(U4e(),mR)});var ffe=b(H4e=>{"use strict";Object.defineProperty(H4e,"__esModule",{value:!0})});var V4e=b(gR=>{"use strict";var L7t=gR&&gR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F7t=gR&&gR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L7t(e,t,r)};Object.defineProperty(gR,"__esModule",{value:!0});F7t(ffe(),gR)});var W4e=b(yR=>{"use strict";var k7t=yR&&yR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B7t=yR&&yR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&k7t(e,t,r)};Object.defineProperty(yR,"__esModule",{value:!0});B7t(V4e(),yR)});var G4e=b(bo=>{"use strict";var J4e=bo&&bo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$7t=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jN=bo&&bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J4e(e,t,r);return $7t(e,t),e},Ox=bo&&bo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&J4e(e,t,r)};Object.defineProperty(bo,"__esModule",{value:!0});bo.models=bo.connectors=bo.finetuning=bo.datasets=bo.embedJobs=bo.v2=void 0;bo.v2=jN(F2e());Ox(nfe(),bo);bo.embedJobs=jN(U2e());Ox(ife(),bo);bo.datasets=jN(r4e());Ox(sfe(),bo);bo.finetuning=jN($4e());bo.connectors=jN(z4e());bo.models=jN(W4e());Ox(ofe(),bo);Ox(afe(),bo);Ox(ufe(),bo);Ox(dfe(),bo);Ox(ffe(),bo);Ox(cfe(),bo)});var K4e=b(kW=>{"use strict";Object.defineProperty(kW,"__esModule",{value:!0});kW.ChatStreamRequestPromptTruncation=void 0;kW.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Y4e=b(BW=>{"use strict";Object.defineProperty(BW,"__esModule",{value:!0});BW.ChatStreamRequestCitationQuality=void 0;BW.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var Z4e=b(X4e=>{"use strict";Object.defineProperty(X4e,"__esModule",{value:!0})});var Q4e=b($W=>{"use strict";Object.defineProperty($W,"__esModule",{value:!0});$W.ChatStreamRequestSafetyMode=void 0;$W.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var t3e=b(e3e=>{"use strict";Object.defineProperty(e3e,"__esModule",{value:!0})});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 c3e=b(qW=>{"use strict";Object.defineProperty(qW,"__esModule",{value:!0});qW.ChatRequestPromptTruncation=void 0;qW.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var d3e=b(UW=>{"use strict";Object.defineProperty(UW,"__esModule",{value:!0});UW.ChatRequestCitationQuality=void 0;UW.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var p3e=b(f3e=>{"use strict";Object.defineProperty(f3e,"__esModule",{value:!0})});var h3e=b(zW=>{"use strict";Object.defineProperty(zW,"__esModule",{value:!0});zW.ChatRequestSafetyMode=void 0;zW.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var m3e=b(HW=>{"use strict";Object.defineProperty(HW,"__esModule",{value:!0});HW.GenerateStreamRequestTruncate=void 0;HW.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var g3e=b(VW=>{"use strict";Object.defineProperty(VW,"__esModule",{value:!0});VW.GenerateStreamRequestReturnLikelihoods=void 0;VW.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var y3e=b(WW=>{"use strict";Object.defineProperty(WW,"__esModule",{value:!0});WW.GenerateRequestTruncate=void 0;WW.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var b3e=b(JW=>{"use strict";Object.defineProperty(JW,"__esModule",{value:!0});JW.GenerateRequestReturnLikelihoods=void 0;JW.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var _3e=b(GW=>{"use strict";Object.defineProperty(GW,"__esModule",{value:!0});GW.EmbedRequestTruncate=void 0;GW.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var w3e=b(v3e=>{"use strict";Object.defineProperty(v3e,"__esModule",{value:!0})});var x3e=b(S3e=>{"use strict";Object.defineProperty(S3e,"__esModule",{value:!0})});var O3e=b(C3e=>{"use strict";Object.defineProperty(C3e,"__esModule",{value:!0})});var P3e=b(E3e=>{"use strict";Object.defineProperty(E3e,"__esModule",{value:!0})});var M3e=b(T3e=>{"use strict";Object.defineProperty(T3e,"__esModule",{value:!0})});var A3e=b(KW=>{"use strict";Object.defineProperty(KW,"__esModule",{value:!0});KW.ClassifyRequestTruncate=void 0;KW.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var I3e=b(R3e=>{"use strict";Object.defineProperty(R3e,"__esModule",{value:!0})});var D3e=b(YW=>{"use strict";Object.defineProperty(YW,"__esModule",{value:!0});YW.ClassifyResponseClassificationsItemClassificationType=void 0;YW.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var N3e=b(j3e=>{"use strict";Object.defineProperty(j3e,"__esModule",{value:!0})});var F3e=b(L3e=>{"use strict";Object.defineProperty(L3e,"__esModule",{value:!0})});var k3e=b(XW=>{"use strict";Object.defineProperty(XW,"__esModule",{value:!0});XW.SummarizeRequestLength=void 0;XW.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var B3e=b(ZW=>{"use strict";Object.defineProperty(ZW,"__esModule",{value:!0});ZW.SummarizeRequestFormat=void 0;ZW.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var $3e=b(QW=>{"use strict";Object.defineProperty(QW,"__esModule",{value:!0});QW.SummarizeRequestExtractiveness=void 0;QW.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var U3e=b(q3e=>{"use strict";Object.defineProperty(q3e,"__esModule",{value:!0})});var H3e=b(z3e=>{"use strict";Object.defineProperty(z3e,"__esModule",{value:!0})});var W3e=b(V3e=>{"use strict";Object.defineProperty(V3e,"__esModule",{value:!0})});var G3e=b(J3e=>{"use strict";Object.defineProperty(J3e,"__esModule",{value:!0})});var Y3e=b(K3e=>{"use strict";Object.defineProperty(K3e,"__esModule",{value:!0})});var Z3e=b(X3e=>{"use strict";Object.defineProperty(X3e,"__esModule",{value:!0})});var e8e=b(Q3e=>{"use strict";Object.defineProperty(Q3e,"__esModule",{value:!0})});var r8e=b(t8e=>{"use strict";Object.defineProperty(t8e,"__esModule",{value:!0})});var o8e=b(n8e=>{"use strict";Object.defineProperty(n8e,"__esModule",{value:!0})});var a8e=b(i8e=>{"use strict";Object.defineProperty(i8e,"__esModule",{value:!0})});var u8e=b(s8e=>{"use strict";Object.defineProperty(s8e,"__esModule",{value:!0})});var c8e=b(l8e=>{"use strict";Object.defineProperty(l8e,"__esModule",{value:!0})});var f8e=b(d8e=>{"use strict";Object.defineProperty(d8e,"__esModule",{value:!0})});var h8e=b(p8e=>{"use strict";Object.defineProperty(p8e,"__esModule",{value:!0})});var g8e=b(m8e=>{"use strict";Object.defineProperty(m8e,"__esModule",{value:!0})});var b8e=b(y8e=>{"use strict";Object.defineProperty(y8e,"__esModule",{value:!0})});var v8e=b(_8e=>{"use strict";Object.defineProperty(_8e,"__esModule",{value:!0})});var S8e=b(w8e=>{"use strict";Object.defineProperty(w8e,"__esModule",{value:!0})});var C8e=b(x8e=>{"use strict";Object.defineProperty(x8e,"__esModule",{value:!0})});var E8e=b(O8e=>{"use strict";Object.defineProperty(O8e,"__esModule",{value:!0})});var P8e=b(eJ=>{"use strict";Object.defineProperty(eJ,"__esModule",{value:!0});eJ.FinishReason=void 0;eJ.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var M8e=b(T8e=>{"use strict";Object.defineProperty(T8e,"__esModule",{value:!0})});var R8e=b(A8e=>{"use strict";Object.defineProperty(A8e,"__esModule",{value:!0})});var D8e=b(I8e=>{"use strict";Object.defineProperty(I8e,"__esModule",{value:!0})});var N8e=b(j8e=>{"use strict";Object.defineProperty(j8e,"__esModule",{value:!0})});var F8e=b(L8e=>{"use strict";Object.defineProperty(L8e,"__esModule",{value:!0})});var B8e=b(k8e=>{"use strict";Object.defineProperty(k8e,"__esModule",{value:!0})});var q8e=b($8e=>{"use strict";Object.defineProperty($8e,"__esModule",{value:!0})});var z8e=b(U8e=>{"use strict";Object.defineProperty(U8e,"__esModule",{value:!0})});var V8e=b(H8e=>{"use strict";Object.defineProperty(H8e,"__esModule",{value:!0})});var J8e=b(W8e=>{"use strict";Object.defineProperty(W8e,"__esModule",{value:!0})});var K8e=b(G8e=>{"use strict";Object.defineProperty(G8e,"__esModule",{value:!0})});var X8e=b(Y8e=>{"use strict";Object.defineProperty(Y8e,"__esModule",{value:!0})});var Z8e=b(tJ=>{"use strict";Object.defineProperty(tJ,"__esModule",{value:!0});tJ.ChatStreamEndEventFinishReason=void 0;tJ.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});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 gHe=b(mHe=>{"use strict";Object.defineProperty(mHe,"__esModule",{value:!0})});var bHe=b(yHe=>{"use strict";Object.defineProperty(yHe,"__esModule",{value:!0})});var vHe=b(_He=>{"use strict";Object.defineProperty(_He,"__esModule",{value:!0})});var SHe=b(wHe=>{"use strict";Object.defineProperty(wHe,"__esModule",{value:!0})});var CHe=b(xHe=>{"use strict";Object.defineProperty(xHe,"__esModule",{value:!0})});var EHe=b(OHe=>{"use strict";Object.defineProperty(OHe,"__esModule",{value:!0})});var THe=b(PHe=>{"use strict";Object.defineProperty(PHe,"__esModule",{value:!0})});var AHe=b(MHe=>{"use strict";Object.defineProperty(MHe,"__esModule",{value:!0})});var IHe=b(RHe=>{"use strict";Object.defineProperty(RHe,"__esModule",{value:!0})});var jHe=b(DHe=>{"use strict";Object.defineProperty(DHe,"__esModule",{value:!0})});var LHe=b(NHe=>{"use strict";Object.defineProperty(NHe,"__esModule",{value:!0})});var kHe=b(FHe=>{"use strict";Object.defineProperty(FHe,"__esModule",{value:!0})});var BHe=b(rJ=>{"use strict";Object.defineProperty(rJ,"__esModule",{value:!0});rJ.EmbedInputType=void 0;rJ.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var $He=b(nJ=>{"use strict";Object.defineProperty(nJ,"__esModule",{value:!0});nJ.EmbeddingType=void 0;nJ.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var UHe=b(qHe=>{"use strict";Object.defineProperty(qHe,"__esModule",{value:!0})});var HHe=b(zHe=>{"use strict";Object.defineProperty(zHe,"__esModule",{value:!0})});var WHe=b(VHe=>{"use strict";Object.defineProperty(VHe,"__esModule",{value:!0})});var JHe=b(oJ=>{"use strict";Object.defineProperty(oJ,"__esModule",{value:!0});oJ.EmbedJobStatus=void 0;oJ.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var GHe=b(iJ=>{"use strict";Object.defineProperty(iJ,"__esModule",{value:!0});iJ.EmbedJobTruncate=void 0;iJ.EmbedJobTruncate={Start:"START",End:"END"}});var YHe=b(KHe=>{"use strict";Object.defineProperty(KHe,"__esModule",{value:!0})});var ZHe=b(XHe=>{"use strict";Object.defineProperty(XHe,"__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 i6e=b(aJ=>{"use strict";Object.defineProperty(aJ,"__esModule",{value:!0});aJ.DatasetValidationStatus=void 0;aJ.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var a6e=b(sJ=>{"use strict";Object.defineProperty(sJ,"__esModule",{value:!0});sJ.DatasetType=void 0;sJ.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 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 T6e=b(P6e=>{"use strict";Object.defineProperty(P6e,"__esModule",{value:!0})});var A6e=b(M6e=>{"use strict";Object.defineProperty(M6e,"__esModule",{value:!0})});var R6e=b(uJ=>{"use strict";Object.defineProperty(uJ,"__esModule",{value:!0});uJ.ConnectorAuthStatus=void 0;uJ.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var D6e=b(I6e=>{"use strict";Object.defineProperty(I6e,"__esModule",{value:!0})});var N6e=b(j6e=>{"use strict";Object.defineProperty(j6e,"__esModule",{value:!0})});var F6e=b(L6e=>{"use strict";Object.defineProperty(L6e,"__esModule",{value:!0})});var k6e=b(lJ=>{"use strict";Object.defineProperty(lJ,"__esModule",{value:!0});lJ.AuthTokenType=void 0;lJ.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});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 G6e=b(J6e=>{"use strict";Object.defineProperty(J6e,"__esModule",{value:!0})});var Y6e=b(K6e=>{"use strict";Object.defineProperty(K6e,"__esModule",{value:!0})});var X6e=b(cJ=>{"use strict";Object.defineProperty(cJ,"__esModule",{value:!0});cJ.CompatibleEndpoint=void 0;cJ.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var Q6e=b(Z6e=>{"use strict";Object.defineProperty(Z6e,"__esModule",{value:!0})});var tVe=b(eVe=>{"use strict";Object.defineProperty(eVe,"__esModule",{value:!0})});var rVe=b(oe=>{"use strict";var q7t=oe&&oe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fe=oe&&oe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&q7t(e,t,r)};Object.defineProperty(oe,"__esModule",{value:!0});fe(K4e(),oe);fe(Y4e(),oe);fe(Z4e(),oe);fe(Q4e(),oe);fe(t3e(),oe);fe(n3e(),oe);fe(i3e(),oe);fe(s3e(),oe);fe(l3e(),oe);fe(c3e(),oe);fe(d3e(),oe);fe(p3e(),oe);fe(h3e(),oe);fe(m3e(),oe);fe(g3e(),oe);fe(y3e(),oe);fe(b3e(),oe);fe(_3e(),oe);fe(w3e(),oe);fe(x3e(),oe);fe(O3e(),oe);fe(P3e(),oe);fe(M3e(),oe);fe(A3e(),oe);fe(I3e(),oe);fe(D3e(),oe);fe(N3e(),oe);fe(F3e(),oe);fe(k3e(),oe);fe(B3e(),oe);fe($3e(),oe);fe(U3e(),oe);fe(H3e(),oe);fe(W3e(),oe);fe(G3e(),oe);fe(Y3e(),oe);fe(Z3e(),oe);fe(e8e(),oe);fe(r8e(),oe);fe(o8e(),oe);fe(a8e(),oe);fe(u8e(),oe);fe(c8e(),oe);fe(f8e(),oe);fe(h8e(),oe);fe(g8e(),oe);fe(b8e(),oe);fe(v8e(),oe);fe(S8e(),oe);fe(C8e(),oe);fe(E8e(),oe);fe(P8e(),oe);fe(M8e(),oe);fe(R8e(),oe);fe(D8e(),oe);fe(N8e(),oe);fe(F8e(),oe);fe(B8e(),oe);fe(q8e(),oe);fe(z8e(),oe);fe(V8e(),oe);fe(J8e(),oe);fe(K8e(),oe);fe(X8e(),oe);fe(Z8e(),oe);fe(eHe(),oe);fe(rHe(),oe);fe(oHe(),oe);fe(aHe(),oe);fe(uHe(),oe);fe(cHe(),oe);fe(fHe(),oe);fe(hHe(),oe);fe(gHe(),oe);fe(bHe(),oe);fe(vHe(),oe);fe(SHe(),oe);fe(CHe(),oe);fe(EHe(),oe);fe(THe(),oe);fe(AHe(),oe);fe(IHe(),oe);fe(jHe(),oe);fe(LHe(),oe);fe(kHe(),oe);fe(BHe(),oe);fe($He(),oe);fe(UHe(),oe);fe(HHe(),oe);fe(WHe(),oe);fe(JHe(),oe);fe(GHe(),oe);fe(YHe(),oe);fe(ZHe(),oe);fe(e6e(),oe);fe(r6e(),oe);fe(o6e(),oe);fe(i6e(),oe);fe(a6e(),oe);fe(u6e(),oe);fe(c6e(),oe);fe(f6e(),oe);fe(h6e(),oe);fe(g6e(),oe);fe(b6e(),oe);fe(v6e(),oe);fe(S6e(),oe);fe(C6e(),oe);fe(E6e(),oe);fe(T6e(),oe);fe(A6e(),oe);fe(R6e(),oe);fe(D6e(),oe);fe(N6e(),oe);fe(F6e(),oe);fe(k6e(),oe);fe($6e(),oe);fe(U6e(),oe);fe(H6e(),oe);fe(W6e(),oe);fe(G6e(),oe);fe(Y6e(),oe);fe(X6e(),oe);fe(Q6e(),oe);fe(tVe(),oe)});var nVe=b(dJ=>{"use strict";Object.defineProperty(dJ,"__esModule",{value:!0});dJ.CohereError=void 0;var Rz=class extends Error{constructor({message:e,statusCode:r,body:n}){super(U7t({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,Rz.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};dJ.CohereError=Rz;function U7t({message:t,statusCode:e,body:r}){let n=[];return t!=null&&n.push(t),e!=null&&n.push(`Status code: ${e.toString()}`),r!=null&&n.push(`Body: ${JSON.stringify(r,void 0,2)}`),n.join(`
`)}});var oVe=b(fJ=>{"use strict";Object.defineProperty(fJ,"__esModule",{value:!0});fJ.CohereTimeoutError=void 0;var Iz=class extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,Iz.prototype)}};fJ.CohereTimeoutError=Iz});var rs=b(NN=>{"use strict";Object.defineProperty(NN,"__esModule",{value:!0});NN.CohereTimeoutError=NN.CohereError=void 0;var z7t=nVe();Object.defineProperty(NN,"CohereError",{enumerable:!0,get:function(){return z7t.CohereError}});var H7t=oVe();Object.defineProperty(NN,"CohereTimeoutError",{enumerable:!0,get:function(){return H7t.CohereTimeoutError}})});var iVe=b(Hy=>{"use strict";var V7t=Hy&&Hy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W7t=Hy&&Hy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J7t=Hy&&Hy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V7t(e,t,r);return W7t(e,t),e};Object.defineProperty(Hy,"__esModule",{value:!0});Hy.BadRequestError=void 0;var G7t=J7t(rs()),Dz=class extends G7t.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,Dz.prototype)}};Hy.BadRequestError=Dz});var aVe=b(Vy=>{"use strict";var K7t=Vy&&Vy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y7t=Vy&&Vy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X7t=Vy&&Vy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K7t(e,t,r);return Y7t(e,t),e};Object.defineProperty(Vy,"__esModule",{value:!0});Vy.UnauthorizedError=void 0;var Z7t=X7t(rs()),jz=class extends Z7t.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,jz.prototype)}};Vy.UnauthorizedError=jz});var sVe=b(Wy=>{"use strict";var Q7t=Wy&&Wy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eYt=Wy&&Wy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tYt=Wy&&Wy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q7t(e,t,r);return eYt(e,t),e};Object.defineProperty(Wy,"__esModule",{value:!0});Wy.ForbiddenError=void 0;var rYt=tYt(rs()),Nz=class extends rYt.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,Nz.prototype)}};Wy.ForbiddenError=Nz});var uVe=b(Jy=>{"use strict";var nYt=Jy&&Jy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oYt=Jy&&Jy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iYt=Jy&&Jy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nYt(e,t,r);return oYt(e,t),e};Object.defineProperty(Jy,"__esModule",{value:!0});Jy.NotFoundError=void 0;var aYt=iYt(rs()),Lz=class extends aYt.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,Lz.prototype)}};Jy.NotFoundError=Lz});var lVe=b(Gy=>{"use strict";var sYt=Gy&&Gy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uYt=Gy&&Gy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lYt=Gy&&Gy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sYt(e,t,r);return uYt(e,t),e};Object.defineProperty(Gy,"__esModule",{value:!0});Gy.UnprocessableEntityError=void 0;var cYt=lYt(rs()),Fz=class extends cYt.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,Fz.prototype)}};Gy.UnprocessableEntityError=Fz});var cVe=b(Ky=>{"use strict";var dYt=Ky&&Ky.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fYt=Ky&&Ky.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pYt=Ky&&Ky.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dYt(e,t,r);return fYt(e,t),e};Object.defineProperty(Ky,"__esModule",{value:!0});Ky.TooManyRequestsError=void 0;var hYt=pYt(rs()),kz=class extends hYt.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,kz.prototype)}};Ky.TooManyRequestsError=kz});var dVe=b(Yy=>{"use strict";var mYt=Yy&&Yy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gYt=Yy&&Yy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yYt=Yy&&Yy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mYt(e,t,r);return gYt(e,t),e};Object.defineProperty(Yy,"__esModule",{value:!0});Yy.ClientClosedRequestError=void 0;var bYt=yYt(rs()),Bz=class extends bYt.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,Bz.prototype)}};Yy.ClientClosedRequestError=Bz});var fVe=b(Xy=>{"use strict";var _Yt=Xy&&Xy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vYt=Xy&&Xy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wYt=Xy&&Xy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Yt(e,t,r);return vYt(e,t),e};Object.defineProperty(Xy,"__esModule",{value:!0});Xy.InternalServerError=void 0;var SYt=wYt(rs()),$z=class extends SYt.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,$z.prototype)}};Xy.InternalServerError=$z});var pVe=b(Zy=>{"use strict";var xYt=Zy&&Zy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CYt=Zy&&Zy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OYt=Zy&&Zy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xYt(e,t,r);return CYt(e,t),e};Object.defineProperty(Zy,"__esModule",{value:!0});Zy.NotImplementedError=void 0;var EYt=OYt(rs()),qz=class extends EYt.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,qz.prototype)}};Zy.NotImplementedError=qz});var hVe=b(Qy=>{"use strict";var PYt=Qy&&Qy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TYt=Qy&&Qy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MYt=Qy&&Qy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PYt(e,t,r);return TYt(e,t),e};Object.defineProperty(Qy,"__esModule",{value:!0});Qy.ServiceUnavailableError=void 0;var AYt=MYt(rs()),Uz=class extends AYt.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,Uz.prototype)}};Qy.ServiceUnavailableError=Uz});var mVe=b(eb=>{"use strict";var RYt=eb&&eb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IYt=eb&&eb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DYt=eb&&eb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RYt(e,t,r);return IYt(e,t),e};Object.defineProperty(eb,"__esModule",{value:!0});eb.GatewayTimeoutError=void 0;var jYt=DYt(rs()),zz=class extends jYt.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,zz.prototype)}};eb.GatewayTimeoutError=zz});var gVe=b(tc=>{"use strict";var NYt=tc&&tc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pg=tc&&tc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NYt(e,t,r)};Object.defineProperty(tc,"__esModule",{value:!0});pg(iVe(),tc);pg(aVe(),tc);pg(sVe(),tc);pg(uVe(),tc);pg(lVe(),tc);pg(cVe(),tc);pg(dVe(),tc);pg(fVe(),tc);pg(pVe(),tc);pg(hVe(),tc);pg(mVe(),tc)});var bVe=b(yVe=>{"use strict";Object.defineProperty(yVe,"__esModule",{value:!0})});var _Ve=b(bR=>{"use strict";var LYt=bR&&bR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FYt=bR&&bR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LYt(e,t,r)};Object.defineProperty(bR,"__esModule",{value:!0});FYt(bVe(),bR)});var Ex=b(tb=>{"use strict";var kYt=tb&&tb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pJ=tb&&tb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kYt(e,t,r)};Object.defineProperty(tb,"__esModule",{value:!0});pJ(G4e(),tb);pJ(rVe(),tb);pJ(gVe(),tb);pJ(_Ve(),tb)});var mfe={};nf(mfe,{__addDisposableResource:()=>$Ve,__assign:()=>hJ,__asyncDelegator:()=>IVe,__asyncGenerator:()=>RVe,__asyncValues:()=>DVe,__await:()=>LN,__awaiter:()=>OVe,__classPrivateFieldGet:()=>FVe,__classPrivateFieldIn:()=>BVe,__classPrivateFieldSet:()=>kVe,__createBinding:()=>gJ,__decorate:()=>SVe,__disposeResources:()=>qVe,__esDecorate:()=>BYt,__exportStar:()=>PVe,__extends:()=>vVe,__generator:()=>EVe,__importDefault:()=>LVe,__importStar:()=>NVe,__makeTemplateObject:()=>jVe,__metadata:()=>CVe,__param:()=>xVe,__propKey:()=>qYt,__read:()=>hfe,__rest:()=>wVe,__runInitializers:()=>$Yt,__setFunctionName:()=>UYt,__spread:()=>TVe,__spreadArray:()=>AVe,__spreadArrays:()=>MVe,__values:()=>mJ,default:()=>VYt});function vVe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pfe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function wVe(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function SVe(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function xVe(t,e){return function(r,n){e(r,n,t)}}function BYt(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var 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 v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function $Yt(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function qYt(t){return typeof t=="symbol"?t:"".concat(t)}function UYt(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function CVe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function OVe(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function EVe(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function PVe(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gJ(e,t,r)}function mJ(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function hfe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function TVe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(hfe(arguments[e]));return t}function MVe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function AVe(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function LN(t){return this instanceof LN?(this.v=t,this):new LN(t)}function RVe(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(v,g){i.push([p,m,v,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 IVe(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:LN(t[o](a)),done:!1}:i?i(a):a}:i}}function DVe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof mJ=="function"?mJ(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function jVe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function NVe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gJ(e,t,r);return zYt(e,t),e}function LVe(t){return t&&t.__esModule?t:{default:t}}function FVe(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function kVe(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function BVe(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function $Ve(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function qVe(t){function e(i){t.error=t.hasError?new HYt(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var pfe,hJ,gJ,zYt,HYt,VYt,gfe=C(()=>{pfe=function(t,e){return pfe=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])},pfe(t,e)};hJ=function(){return hJ=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},hJ.apply(this,arguments)};gJ=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};zYt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};HYt=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};VYt={__extends:vVe,__assign:hJ,__rest:wVe,__decorate:SVe,__param:xVe,__metadata:CVe,__awaiter:OVe,__generator:EVe,__createBinding:gJ,__exportStar:PVe,__values:mJ,__read:hfe,__spread:TVe,__spreadArrays:MVe,__spreadArray:AVe,__await:LN,__asyncGenerator:RVe,__asyncDelegator:IVe,__asyncValues:DVe,__makeTemplateObject:jVe,__importStar:NVe,__importDefault:LVe,__classPrivateFieldGet:FVe,__classPrivateFieldSet:kVe,__classPrivateFieldIn:BVe,__addDisposableResource:$Ve,__disposeResources:qVe}});var yfe=b(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.MAX_HASHABLE_LENGTH=Oh.INIT=Oh.KEY=Oh.DIGEST_LENGTH=Oh.BLOCK_SIZE=void 0;Oh.BLOCK_SIZE=64;Oh.DIGEST_LENGTH=32;Oh.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]);Oh.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Oh.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var UVe=b(yJ=>{"use strict";Object.defineProperty(yJ,"__esModule",{value:!0});yJ.RawSha256=void 0;var Eh=yfe(),WYt=function(){function t(){this.state=Int32Array.from(Eh.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return t.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var r=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>Eh.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===Eh.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%Eh.BLOCK_SIZE>=Eh.BLOCK_SIZE-8){for(var o=this.bufferLength;o<Eh.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<Eh.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(Eh.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(Eh.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(Eh.DIGEST_LENGTH),o=0;o<8;o++)i[o*4]=this.state[o]>>>24&255,i[o*4+1]=this.state[o]>>>16&255,i[o*4+2]=this.state[o]>>>8&255,i[o*4+3]=this.state[o]>>>0&255;return i},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,o=n[0],i=n[1],a=n[2],s=n[3],u=n[4],l=n[5],c=n[6],d=n[7],f=0;f<Eh.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 v=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(Eh.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+v|0,s=a,a=i,i=o,o=v+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();yJ.RawSha256=WYt});var VVe=b((bDn,HVe)=>{var bJ=Object.defineProperty,JYt=Object.getOwnPropertyDescriptor,GYt=Object.getOwnPropertyNames,KYt=Object.prototype.hasOwnProperty,YYt=(t,e)=>bJ(t,"name",{value:e,configurable:!0}),XYt=(t,e)=>{for(var r in e)bJ(t,r,{get:e[r],enumerable:!0})},ZYt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of GYt(e))!KYt.call(t,o)&&o!==r&&bJ(t,o,{get:()=>e[o],enumerable:!(n=JYt(e,o))||n.enumerable});return t},QYt=t=>ZYt(bJ({},"__esModule",{value:!0}),t),zVe={};XYt(zVe,{isArrayBuffer:()=>eXt});HVe.exports=QYt(zVe);var eXt=YYt(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var _fe=b(_J=>{"use strict";_J.byteLength=rXt;_J.toByteArray=oXt;_J.fromByteArray=sXt;var rb=[],Ph=[],tXt=typeof Uint8Array<"u"?Uint8Array:Array,bfe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_R=0,WVe=bfe.length;_R<WVe;++_R)rb[_R]=bfe[_R],Ph[bfe.charCodeAt(_R)]=_R;var _R,WVe;Ph["-".charCodeAt(0)]=62;Ph["_".charCodeAt(0)]=63;function JVe(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function rXt(t){var e=JVe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function nXt(t,e,r){return(e+r)*3/4-r}function oXt(t){var e,r=JVe(t),n=r[0],o=r[1],i=new tXt(nXt(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Ph[t.charCodeAt(u)]<<18|Ph[t.charCodeAt(u+1)]<<12|Ph[t.charCodeAt(u+2)]<<6|Ph[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Ph[t.charCodeAt(u)]<<2|Ph[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Ph[t.charCodeAt(u)]<<10|Ph[t.charCodeAt(u+1)]<<4|Ph[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function iXt(t){return rb[t>>18&63]+rb[t>>12&63]+rb[t>>6&63]+rb[t&63]}function aXt(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(iXt(n));return o.join("")}function sXt(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(aXt(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(rb[e>>2]+rb[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(rb[e>>10]+rb[e>>4&63]+rb[e<<2&63]+"=")),o.join("")}});var GVe=b(vfe=>{vfe.read=function(t,e,r,n,o){var i,a,s=o*8-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?o-1:0,f=r?-1:1,p=t[e+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+t[e+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+t[e+d],d+=f,c-=8);if(i===0)i=1-l;else{if(i===u)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-l}return(p?-1:1)*a*Math.pow(2,i-n)};vfe.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=h,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=h,a/=256,l-=8);t[r+p-h]|=m*128}});var hg=b($N=>{"use strict";var wfe=_fe(),kN=GVe(),KVe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;$N.Buffer=ce;$N.SlowBuffer=pXt;$N.INSPECT_MAX_BYTES=50;var vJ=2147483647;$N.kMaxLength=vJ;ce.TYPED_ARRAY_SUPPORT=uXt();!ce.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 uXt(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(ce.prototype,"parent",{enumerable:!0,get:function(){if(ce.isBuffer(this))return this.buffer}});Object.defineProperty(ce.prototype,"offset",{enumerable:!0,get:function(){if(ce.isBuffer(this))return this.byteOffset}});function Px(t){if(t>vJ)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,ce.prototype),e}function ce(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ofe(t)}return QVe(t,e,r)}ce.poolSize=8192;function QVe(t,e,r){if(typeof t=="string")return cXt(t,e);if(ArrayBuffer.isView(t))return dXt(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(nb(t,ArrayBuffer)||t&&nb(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nb(t,SharedArrayBuffer)||t&&nb(t.buffer,SharedArrayBuffer)))return xfe(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return ce.from(n,e,r);let o=fXt(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ce.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}ce.from=function(t,e,r){return QVe(t,e,r)};Object.setPrototypeOf(ce.prototype,Uint8Array.prototype);Object.setPrototypeOf(ce,Uint8Array);function e5e(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function lXt(t,e,r){return e5e(t),t<=0?Px(t):e!==void 0?typeof r=="string"?Px(t).fill(e,r):Px(t).fill(e):Px(t)}ce.alloc=function(t,e,r){return lXt(t,e,r)};function Ofe(t){return e5e(t),Px(t<0?0:Efe(t)|0)}ce.allocUnsafe=function(t){return Ofe(t)};ce.allocUnsafeSlow=function(t){return Ofe(t)};function cXt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ce.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=t5e(t,e)|0,n=Px(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function Sfe(t){let e=t.length<0?0:Efe(t.length)|0,r=Px(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function dXt(t){if(nb(t,Uint8Array)){let e=new Uint8Array(t);return xfe(e.buffer,e.byteOffset,e.byteLength)}return Sfe(t)}function xfe(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,ce.prototype),n}function fXt(t){if(ce.isBuffer(t)){let e=Efe(t.length)|0,r=Px(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Tfe(t.length)?Px(0):Sfe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Sfe(t.data)}function Efe(t){if(t>=vJ)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vJ.toString(16)+" bytes");return t|0}function pXt(t){return+t!=t&&(t=0),ce.alloc(+t)}ce.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ce.prototype};ce.compare=function(e,r){if(nb(e,Uint8Array)&&(e=ce.from(e,e.offset,e.byteLength)),nb(r,Uint8Array)&&(r=ce.from(r,r.offset,r.byteLength)),!ce.isBuffer(e)||!ce.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,o=r.length;for(let i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};ce.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};ce.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ce.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=ce.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(nb(a,Uint8Array))i+a.length>o.length?(ce.isBuffer(a)||(a=ce.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(ce.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function t5e(t,e){if(ce.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||nb(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Cfe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return c5e(t).length;default:if(o)return n?-1:Cfe(t).length;e=(""+e).toLowerCase(),o=!0}}ce.byteLength=t5e;function hXt(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return CXt(this,e,r);case"utf8":case"utf-8":return n5e(this,e,r);case"ascii":return SXt(this,e,r);case"latin1":case"binary":return xXt(this,e,r);case"base64":return vXt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OXt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}ce.prototype._isBuffer=!0;function vR(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}ce.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)vR(this,r,r+1);return this};ce.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)vR(this,r,r+3),vR(this,r+1,r+2);return this};ce.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)vR(this,r,r+7),vR(this,r+1,r+6),vR(this,r+2,r+5),vR(this,r+3,r+4);return this};ce.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?n5e(this,0,e):hXt.apply(this,arguments)};ce.prototype.toLocaleString=ce.prototype.toString;ce.prototype.equals=function(e){if(!ce.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:ce.compare(this,e)===0};ce.prototype.inspect=function(){let e="",r=$N.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};KVe&&(ce.prototype[KVe]=ce.prototype.inspect);ce.prototype.compare=function(e,r,n,o,i){if(nb(e,Uint8Array)&&(e=ce.from(e,e.offset,e.byteLength)),!ce.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;let a=i-o,s=n-r,u=Math.min(a,s),l=this.slice(o,i),c=e.slice(r,n);for(let d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],s=c[d];break}return a<s?-1:s<a?1:0};function r5e(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Tfe(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=ce.from(e,n)),ce.isBuffer(e))return e.length===0?-1:YVe(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):YVe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function YVe(t,e,r,n,o){let i=1,a=t.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,a/=2,s/=2,r/=2}function u(c,d){return i===1?c[d]:c.readUInt16BE(d*i)}let l;if(o){let c=-1;for(l=r;l<a;l++)if(u(t,l)===u(e,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===s)return c*i}else c!==-1&&(l-=l-c),c=-1}else for(r+s>a&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;d<s;d++)if(u(t,l+d)!==u(e,d)){c=!1;break}if(c)return l}return-1}ce.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};ce.prototype.indexOf=function(e,r,n){return r5e(this,e,r,n,!0)};ce.prototype.lastIndexOf=function(e,r,n){return r5e(this,e,r,n,!1)};function mXt(t,e,r,n){r=Number(r)||0;let o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=e.length;n>i/2&&(n=i/2);let a;for(a=0;a<n;++a){let s=parseInt(e.substr(a*2,2),16);if(Tfe(s))return a;t[r+a]=s}return a}function gXt(t,e,r,n){return wJ(Cfe(e,t.length-r),t,r,n)}function yXt(t,e,r,n){return wJ(MXt(e),t,r,n)}function bXt(t,e,r,n){return wJ(c5e(e),t,r,n)}function _Xt(t,e,r,n){return wJ(AXt(e,t.length-r),t,r,n)}ce.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let a=!1;for(;;)switch(o){case"hex":return mXt(this,e,r,n);case"utf8":case"utf-8":return gXt(this,e,r,n);case"ascii":case"latin1":case"binary":return yXt(this,e,r,n);case"base64":return bXt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _Xt(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};ce.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vXt(t,e,r){return e===0&&r===t.length?wfe.fromByteArray(t):wfe.fromByteArray(t.slice(e,r))}function n5e(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o<r;){let i=t[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=r){let u,l,c,d;switch(s){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=t[o+1],l=t[o+2],(u&192)===128&&(l&192)===128&&(d=(i&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:u=t[o+1],l=t[o+2],c=t[o+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=s}return wXt(n)}var XVe=4096;function wXt(t){let e=t.length;if(e<=XVe)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=XVe));return r}function SXt(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function xXt(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function CXt(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=e;i<r;++i)o+=RXt[t[i]];return o}function OXt(t,e,r){let n=t.slice(e,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}ce.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let o=this.subarray(e,r);return Object.setPrototypeOf(o,ce.prototype),o};function Cl(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}ce.prototype.readUintLE=ce.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Cl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};ce.prototype.readUintBE=ce.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Cl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};ce.prototype.readUint8=ce.prototype.readUInt8=function(e,r){return e=e>>>0,r||Cl(e,1,this.length),this[e]};ce.prototype.readUint16LE=ce.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Cl(e,2,this.length),this[e]|this[e+1]<<8};ce.prototype.readUint16BE=ce.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Cl(e,2,this.length),this[e]<<8|this[e+1]};ce.prototype.readUint32LE=ce.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ce.prototype.readUint32BE=ce.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ce.prototype.readBigUInt64LE=JE(function(e){e=e>>>0,BN(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hz(e,this.length-8);let o=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});ce.prototype.readBigUInt64BE=JE(function(e){e=e>>>0,BN(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hz(e,this.length-8);let o=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});ce.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Cl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};ce.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Cl(e,r,this.length);let o=r,i=1,a=this[e+--o];for(;o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};ce.prototype.readInt8=function(e,r){return e=e>>>0,r||Cl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ce.prototype.readInt16LE=function(e,r){e=e>>>0,r||Cl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};ce.prototype.readInt16BE=function(e,r){e=e>>>0,r||Cl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};ce.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ce.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ce.prototype.readBigInt64LE=JE(function(e){e=e>>>0,BN(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hz(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});ce.prototype.readBigInt64BE=JE(function(e){e=e>>>0,BN(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hz(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});ce.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),kN.read(this,e,!0,23,4)};ce.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Cl(e,4,this.length),kN.read(this,e,!1,23,4)};ce.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Cl(e,8,this.length),kN.read(this,e,!0,52,8)};ce.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Cl(e,8,this.length),kN.read(this,e,!1,52,8)};function xf(t,e,r,n,o,i){if(!ce.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}ce.prototype.writeUintLE=ce.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;xf(this,e,r,n,s,0)}let i=1,a=0;for(this[r]=e&255;++a<n&&(i*=256);)this[r+a]=e/i&255;return r+n};ce.prototype.writeUintBE=ce.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;xf(this,e,r,n,s,0)}let i=n-1,a=1;for(this[r+i]=e&255;--i>=0&&(a*=256);)this[r+i]=e/a&255;return r+n};ce.prototype.writeUint8=ce.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,1,255,0),this[r]=e&255,r+1};ce.prototype.writeUint16LE=ce.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ce.prototype.writeUint16BE=ce.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ce.prototype.writeUint32LE=ce.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};ce.prototype.writeUint32BE=ce.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function o5e(t,e,r,n,o){l5e(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function i5e(t,e,r,n,o){l5e(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i=i>>8,t[r+6]=i,i=i>>8,t[r+5]=i,i=i>>8,t[r+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}ce.prototype.writeBigUInt64LE=JE(function(e,r=0){return o5e(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ce.prototype.writeBigUInt64BE=JE(function(e,r=0){return i5e(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ce.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);xf(this,e,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=e&255;++i<n&&(a*=256);)e<0&&s===0&&this[r+i-1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};ce.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);xf(this,e,r,n,u-1,-u)}let i=n-1,a=1,s=0;for(this[r+i]=e&255;--i>=0&&(a*=256);)e<0&&s===0&&this[r+i+1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};ce.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ce.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ce.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ce.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};ce.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xf(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};ce.prototype.writeBigInt64LE=JE(function(e,r=0){return o5e(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ce.prototype.writeBigInt64BE=JE(function(e,r=0){return i5e(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function a5e(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function s5e(t,e,r,n,o){return e=+e,r=r>>>0,o||a5e(t,e,r,4,34028234663852886e22,-34028234663852886e22),kN.write(t,e,r,n,23,4),r+4}ce.prototype.writeFloatLE=function(e,r,n){return s5e(this,e,r,!0,n)};ce.prototype.writeFloatBE=function(e,r,n){return s5e(this,e,r,!1,n)};function u5e(t,e,r,n,o){return e=+e,r=r>>>0,o||a5e(t,e,r,8,17976931348623157e292,-17976931348623157e292),kN.write(t,e,r,n,52,8),r+8}ce.prototype.writeDoubleLE=function(e,r,n){return u5e(this,e,r,!0,n)};ce.prototype.writeDoubleBE=function(e,r,n){return u5e(this,e,r,!1,n)};ce.prototype.copy=function(e,r,n,o){if(!ce.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);let i=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),i};ce.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!ce.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let a=e.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{let a=ce.isBuffer(e)?e:ce.from(e,o),s=a.length;if(s===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=a[i%s]}return this};var FN={};function Pfe(t,e,r){FN[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Pfe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Pfe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Pfe("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=ZVe(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=ZVe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function ZVe(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function EXt(t,e,r){BN(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Hz(e,t.length-(r+1))}function l5e(t,e,r,n,o,i){if(t>r||t<e){let a=typeof e=="bigint"?"n":"",s;throw i>3?e===0||e===BigInt(0)?s=`>= 0${a} and < 2${a} ** ${(i+1)*8}${a}`:s=`>= -(2${a} ** ${(i+1)*8-1}${a}) and < 2 ** ${(i+1)*8-1}${a}`:s=`>= ${e}${a} and <= ${r}${a}`,new FN.ERR_OUT_OF_RANGE("value",s,t)}EXt(n,o,i)}function BN(t,e){if(typeof t!="number")throw new FN.ERR_INVALID_ARG_TYPE(e,"number",t)}function Hz(t,e,r){throw Math.floor(t)!==t?(BN(t,r),new FN.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new FN.ERR_BUFFER_OUT_OF_BOUNDS:new FN.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var PXt=/[^+/0-9A-Za-z-_]/g;function TXt(t){if(t=t.split("=")[0],t=t.trim().replace(PXt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Cfe(t,e){e=e||1/0;let r,n=t.length,o=null,i=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function MXt(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function AXt(t,e){let r,n,o,i=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function c5e(t){return wfe.toByteArray(TXt(t))}function wJ(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function nb(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Tfe(t){return t!==t}var RXt=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function JE(t){return typeof BigInt>"u"?IXt:t}function IXt(){throw new Error("BigInt not supported")}});var h5e=b((xDn,p5e)=>{var SJ=Object.defineProperty,DXt=Object.getOwnPropertyDescriptor,jXt=Object.getOwnPropertyNames,NXt=Object.prototype.hasOwnProperty,d5e=(t,e)=>SJ(t,"name",{value:e,configurable:!0}),LXt=(t,e)=>{for(var r in e)SJ(t,r,{get:e[r],enumerable:!0})},FXt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jXt(e))!NXt.call(t,o)&&o!==r&&SJ(t,o,{get:()=>e[o],enumerable:!(n=DXt(e,o))||n.enumerable});return t},kXt=t=>FXt(SJ({},"__esModule",{value:!0}),t),f5e={};LXt(f5e,{fromArrayBuffer:()=>$Xt,fromString:()=>qXt});p5e.exports=kXt(f5e);var BXt=VVe(),Mfe=hg(),$Xt=d5e((t,e=0,r=t.byteLength-e)=>{if(!(0,BXt.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Mfe.Buffer.from(t,e,r)},"fromArrayBuffer"),qXt=d5e((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Mfe.Buffer.from(t,e):Mfe.Buffer.from(t)},"fromString")});var _5e=b((CDn,b5e)=>{var xJ=Object.defineProperty,UXt=Object.getOwnPropertyDescriptor,zXt=Object.getOwnPropertyNames,HXt=Object.prototype.hasOwnProperty,Afe=(t,e)=>xJ(t,"name",{value:e,configurable:!0}),VXt=(t,e)=>{for(var r in e)xJ(t,r,{get:e[r],enumerable:!0})},WXt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zXt(e))!HXt.call(t,o)&&o!==r&&xJ(t,o,{get:()=>e[o],enumerable:!(n=UXt(e,o))||n.enumerable});return t},JXt=t=>WXt(xJ({},"__esModule",{value:!0}),t),m5e={};VXt(m5e,{fromUtf8:()=>y5e,toUint8Array:()=>GXt,toUtf8:()=>KXt});b5e.exports=JXt(m5e);var g5e=h5e(),y5e=Afe(t=>{let e=(0,g5e.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),GXt=Afe(t=>typeof t=="string"?y5e(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),KXt=Afe(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,g5e.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var v5e=b(CJ=>{"use strict";Object.defineProperty(CJ,"__esModule",{value:!0});CJ.convertToBuffer=void 0;var YXt=_5e(),XXt=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:YXt.fromUtf8;function ZXt(t){return t instanceof Uint8Array?t:typeof t=="string"?XXt(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}CJ.convertToBuffer=ZXt});var w5e=b(OJ=>{"use strict";Object.defineProperty(OJ,"__esModule",{value:!0});OJ.isEmptyData=void 0;function QXt(t){return typeof t=="string"?t.length===0:t.byteLength===0}OJ.isEmptyData=QXt});var S5e=b(EJ=>{"use strict";Object.defineProperty(EJ,"__esModule",{value:!0});EJ.numToUint8=void 0;function eZt(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}EJ.numToUint8=eZt});var x5e=b(PJ=>{"use strict";Object.defineProperty(PJ,"__esModule",{value:!0});PJ.uint32ArrayFrom=void 0;function tZt(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}PJ.uint32ArrayFrom=tZt});var TJ=b(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.uint32ArrayFrom=ob.numToUint8=ob.isEmptyData=ob.convertToBuffer=void 0;var rZt=v5e();Object.defineProperty(ob,"convertToBuffer",{enumerable:!0,get:function(){return rZt.convertToBuffer}});var nZt=w5e();Object.defineProperty(ob,"isEmptyData",{enumerable:!0,get:function(){return nZt.isEmptyData}});var oZt=S5e();Object.defineProperty(ob,"numToUint8",{enumerable:!0,get:function(){return oZt.numToUint8}});var iZt=x5e();Object.defineProperty(ob,"uint32ArrayFrom",{enumerable:!0,get:function(){return iZt.uint32ArrayFrom}})});var O5e=b(RJ=>{"use strict";Object.defineProperty(RJ,"__esModule",{value:!0});RJ.Sha256=void 0;var C5e=(gfe(),ml(mfe)),AJ=yfe(),MJ=UVe(),Rfe=TJ(),aZt=function(){function t(e){this.secret=e,this.hash=new MJ.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,Rfe.isEmptyData)(e)||this.error))try{this.hash.update((0,Rfe.convertToBuffer)(e))}catch(r){this.error=r}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return C5e.__awaiter(this,void 0,void 0,function(){return C5e.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new MJ.RawSha256,this.secret){this.outer=new MJ.RawSha256;var e=sZt(this.secret),r=new Uint8Array(AJ.BLOCK_SIZE);r.set(e);for(var n=0;n<AJ.BLOCK_SIZE;n++)e[n]^=54,r[n]^=92;this.hash.update(e),this.outer.update(r);for(var n=0;n<e.byteLength;n++)e[n]=0}},t}();RJ.Sha256=aZt;function sZt(t){var e=(0,Rfe.convertToBuffer)(t);if(e.byteLength>AJ.BLOCK_SIZE){var r=new MJ.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(AJ.BLOCK_SIZE);return n.set(e),n}});var Dfe=b(Ife=>{"use strict";Object.defineProperty(Ife,"__esModule",{value:!0});var uZt=(gfe(),ml(mfe));uZt.__exportStar(O5e(),Ife)});var E5e=C(()=>{});var P5e=C(()=>{});var T5e=C(()=>{});var Tx,Vz=C(()=>{Tx=class extends Error{constructor(e,r=!0){let n,o=!0;typeof r=="boolean"?(n=void 0,o=r):r!=null&&typeof r=="object"&&(n=r.logger,o=r.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,Tx.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var ns,M5e=C(()=>{Vz();ns=class extends Tx{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,ns.prototype)}}});var A5e=C(()=>{Vz()});var R5e=C(()=>{Vz()});var I5e=C(()=>{});var D5e,j5e=C(()=>{D5e=(t,e,r)=>{let n,o,i,a=!1,s=async()=>{o||(o=t());try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return e===void 0?async u=>((!i||u?.forceRefresh)&&(n=await s()),n):async u=>((!i||u?.forceRefresh)&&(n=await s()),a?n:r&&!r(n)?(a=!0,n):(e(n)&&await s(),n))}});var Mx=C(()=>{M5e();Vz();A5e();R5e();I5e();j5e()});function IJ(t){return Promise.all(Object.keys(t).reduce((e,r)=>{let n=t[r];return typeof n=="string"?e.push([r,n]):e.push(n().then(o=>[r,o])),e},[])).then(e=>e.reduce((r,[n,o])=>(r[n]=o,r),{}))}var jfe=C(()=>{});var N5e=C(()=>{});var L5e=C(()=>{N5e()});var F5e=C(()=>{});var k5e,B5e=C(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(k5e||(k5e={}))});var Nfe,$5e=C(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Nfe||(Nfe={}))});var q5e=C(()=>{});var U5e=C(()=>{});var z5e=C(()=>{});var H5e=C(()=>{});var V5e=C(()=>{B5e();$5e();q5e();U5e();z5e();H5e()});var W5e=C(()=>{});var J5e=C(()=>{});var G5e=C(()=>{});var K5e=C(()=>{});var Y5e=C(()=>{});var X5e=C(()=>{});var Z5e=C(()=>{});var Q5e=C(()=>{Y5e();X5e();Z5e()});var e9e=C(()=>{});var t9e=C(()=>{});var qN,r9e=C(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(qN||(qN={}))});var n9e=C(()=>{});var o9e=C(()=>{});var i9e=C(()=>{});var a9e=C(()=>{});var s9e=C(()=>{});var u9e=C(()=>{n9e();o9e();i9e();a9e();s9e()});var l9e=C(()=>{});var UN,Lfe=C(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(UN||(UN={}))});var c9e=C(()=>{Lfe()});var d9e=C(()=>{});var f9e=C(()=>{c9e();d9e();Lfe()});var vp,p9e=C(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(vp||(vp={}))});var h9e=C(()=>{});var m9e=C(()=>{});var g9e=C(()=>{});var y9e=C(()=>{});var b9e=C(()=>{});var _9e=C(()=>{m9e();g9e();y9e();b9e()});var v9e=C(()=>{});var zN,w9e=C(()=>{zN="__smithy_context"});var S9e=C(()=>{});var x9e,C9e=C(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(x9e||(x9e={}))});var O9e=C(()=>{});var E9e=C(()=>{});var P9e=C(()=>{});var T9e=C(()=>{});var M9e=C(()=>{});var A9e=C(()=>{});var R9e=C(()=>{});var I9e=C(()=>{});var D9e=C(()=>{});var j9e,N9e=C(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(j9e||(j9e={}))});var L9e=C(()=>{});var F9e=C(()=>{});var k9e=C(()=>{});var B9e=C(()=>{});var $9e=C(()=>{});var q9e=C(()=>{});var vs=C(()=>{F5e();V5e();W5e();J5e();G5e();K5e();Q5e();e9e();t9e();r9e();u9e();l9e();f9e();p9e();h9e();_9e();v9e();w9e();S9e();C9e();O9e();E9e();P9e();T9e();M9e();A9e();R9e();I9e();D9e();N9e();L9e();F9e();k9e();B9e();$9e();q9e()});var U9e=C(()=>{vs()});var z9e=C(()=>{});var H9e=C(()=>{});function lZt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var wR,V9e=C(()=>{wR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new wR({...e,headers:{...e.headers}});return r.query&&(r.query=lZt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return wR.clone(this)}}});var W9e=C(()=>{});var J9e=C(()=>{});var G9e=C(()=>{});var K9e=C(()=>{L5e();U9e();z9e();H9e();V9e();W9e();J9e();G9e()});var cZt,dZt,DJ,Ffe=C(()=>{K9e();cZt=t=>e=>async r=>{if(!wR.isInstance(r.request))return e(r);let{request:n}=r,{handlerProtocol:o=""}=t.requestHandler.metadata||{};if(o.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;n.port!=null&&(i+=`:${n.port}`),n.headers.host=i}return e(r)},dZt={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},DJ=t=>({applyToStack:e=>{e.add(cZt(t),dZt)}})});var fZt,pZt,jJ,Y9e=C(()=>{fZt=()=>(t,e)=>async r=>{try{let n=await t(r),{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:l}=s,c=u??e.inputFilterSensitiveLog,d=l??e.outputFilterSensitiveLog,{$metadata:f,...p}=n.output;return a?.info?.({clientName:o,commandName:i,input:c(r.input),output:d(p),metadata:f}),n}catch(n){let{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u}=s,l=u??e.inputFilterSensitiveLog;throw a?.error?.({clientName:o,commandName:i,input:l(r.input),error:n,metadata:n.$metadata}),n}},pZt={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},jJ=t=>({applyToStack:e=>{e.add(fZt(),pZt)}})});var kfe=C(()=>{Y9e()});var X9e=C(()=>{});var Z9e=C(()=>{X9e()});var Q9e=C(()=>{vs()});var eWe=C(()=>{});var tWe=C(()=>{});function hZt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var SR,rWe=C(()=>{SR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new SR({...e,headers:{...e.headers}});return r.query&&(r.query=hZt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return SR.clone(this)}}});var nWe=C(()=>{});var oWe=C(()=>{});var iWe=C(()=>{});var aWe=C(()=>{Z9e();Q9e();eWe();tWe();rWe();nWe();oWe();iWe()});var sWe,mZt,gZt,yZt,bZt,NJ,Bfe=C(()=>{aWe();sWe="X-Amzn-Trace-Id",mZt="AWS_LAMBDA_FUNCTION_NAME",gZt="_X_AMZN_TRACE_ID",yZt=t=>e=>async r=>{let{request:n}=r;if(!SR.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(sWe))return e(r);let o=process.env[mZt],i=process.env[gZt],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[sWe]=i),e({...r,request:n})},bZt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},NJ=t=>({applyToStack:e=>{e.add(yZt(t),bZt)}})});function LJ(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var uWe=C(()=>{});var _Zt,Wz,$fe=C(()=>{_Zt=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}$"),Wz=t=>_Zt.test(t)||t.startsWith("[")&&t.endsWith("]")});var vZt,Jz,qfe=C(()=>{vZt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Jz=(t,e=!1)=>{if(!e)return vZt.test(t);let r=t.split(".");for(let n of r)if(!Jz(n))return!1;return!0}});var Ax,FJ=C(()=>{Ax={}});var Rx,lWe=C(()=>{Rx="endpoints"});function Th(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Th(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Th).join(", ")})`:JSON.stringify(t,null,2)}var cWe=C(()=>{});var Gz=C(()=>{lWe();cWe()});var li,dWe=C(()=>{li=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var fWe=C(()=>{});var pWe=C(()=>{});var hWe=C(()=>{});var mWe=C(()=>{});var gWe=C(()=>{});var yWe=C(()=>{});var Mh=C(()=>{dWe();fWe();pWe();hWe();mWe();gWe();yWe()});var bWe,_We=C(()=>{bWe=(t,e)=>t===e});var vWe,wWe=C(()=>{Mh();vWe=t=>{let e=t.split("."),r=[];for(let n of e){let o=n.indexOf("[");if(o!==-1){if(n.indexOf("]")!==n.length-1)throw new li(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new li(`Invalid array index: '${i}' in path: '${t}'`);o!==0&&r.push(n.slice(0,o)),r.push(i)}else r.push(n)}return r}});var kJ,SWe=C(()=>{Mh();wWe();kJ=(t,e)=>vWe(e).reduce((r,n)=>{if(typeof r!="object")throw new li(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var xWe,CWe=C(()=>{xWe=t=>t!=null});var OWe,EWe=C(()=>{OWe=t=>!t});var Ufe,PWe,TWe=C(()=>{vs();$fe();Ufe={[qN.HTTP]:80,[qN.HTTPS]:443},PWe=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:h="",path:m="",query:v={}}=t,g=new URL(`${h}//${f}${p?`:${p}`:""}${m}`);return g.search=Object.entries(v).map(([_,S])=>`${_}=${S}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(qN).includes(u))return null;let l=Wz(o),c=r.includes(`${n}:${Ufe[u]}`)||typeof t=="string"&&t.includes(`${n}:${Ufe[u]}`),d=`${n}${c?`:${Ufe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var MWe,AWe=C(()=>{MWe=(t,e)=>t===e});var RWe,IWe=C(()=>{RWe=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var DWe,jWe=C(()=>{DWe=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var zfe=C(()=>{_We();SWe();CWe();qfe();EWe();TWe();AWe();IWe();jWe()});var NWe,LWe=C(()=>{zfe();NWe={booleanEquals:bWe,getAttr:kJ,isSet:xWe,isValidHostLabel:Jz,not:OWe,parseURL:PWe,stringEquals:MWe,substring:RWe,uriEncode:DWe}});var BJ,Hfe=C(()=>{zfe();BJ=(t,e)=>{let r=[],n={...e.endpointParams,...e.referenceRecord},o=0;for(;o<t.length;){let i=t.indexOf("{",o);if(i===-1){r.push(t.slice(o));break}r.push(t.slice(o,i));let a=t.indexOf("}",i);if(a===-1){r.push(t.slice(i));break}t[i+1]==="{"&&t[a+1]==="}"&&(r.push(t.slice(i+1,a)),o=a+2);let s=t.substring(i+1,a);if(s.includes("#")){let[u,l]=s.split("#");r.push(kJ(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var FWe,kWe=C(()=>{FWe=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var GE,Kz=C(()=>{Mh();Vfe();Hfe();kWe();GE=(t,e,r)=>{if(typeof t=="string")return BJ(t,r);if(t.fn)return $J(t,r);if(t.ref)return FWe(t,r);throw new li(`'${e}': ${String(t)} is not a string, function or reference.`)}});var $J,Vfe=C(()=>{FJ();LWe();Kz();$J=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:GE(i,"arg",r)),o=t.split(".");return o[0]in Ax&&o[1]!=null?Ax[o[0]][o[1]](...n):NWe[t](...n)}});var BWe,$We=C(()=>{Gz();Mh();Vfe();BWe=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new li(`'${t}' is already defined in Reference Record.`);let n=$J(e,r);return r.logger?.debug?.(`${Rx} evaluateCondition: ${Th(e)} = ${Th(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var HN,qJ=C(()=>{Gz();$We();HN=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=BWe(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${Rx} assign: ${i.name} := ${Th(i.value)}`))}return{result:!0,referenceRecord:r}}});var qWe,UWe=C(()=>{Mh();Kz();qWe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=GE(i,"Header value entry",e);if(typeof a!="string")throw new li(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var Wfe,zWe=C(()=>{Mh();Hfe();Jfe();Wfe=(t,e)=>{if(Array.isArray(t))return t.map(r=>Wfe(r,e));switch(typeof t){case"string":return BJ(t,e);case"object":if(t===null)throw new li(`Unexpected endpoint property: ${t}`);return UJ(t,e);case"boolean":return t;default:throw new li(`Unexpected endpoint property type: ${typeof t}`)}}});var UJ,Jfe=C(()=>{zWe();UJ=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:Wfe(o,e)}),{})});var HWe,VWe=C(()=>{Mh();Kz();HWe=(t,e)=>{let r=GE(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new li(`Endpoint URL must be a string, got ${typeof r}`)}});var WWe,JWe=C(()=>{Gz();qJ();UWe();Jfe();VWe();WWe=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=HN(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${Rx} Resolving endpoint from template: ${Th(n)}`),{...l!=null&&{headers:qWe(l,a)},...u!=null&&{properties:UJ(u,a)},url:HWe(s,a)}}});var GWe,KWe=C(()=>{Mh();qJ();Kz();GWe=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=HN(r,e);if(o)throw new li(GE(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var YWe,XWe=C(()=>{qJ();Gfe();YWe=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=HN(r,e);if(o)return zJ(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var zJ,Gfe=C(()=>{Mh();JWe();KWe();XWe();zJ=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=WWe(r,e);if(n)return n}else if(r.type==="error")GWe(r,e);else if(r.type==="tree"){let n=YWe(r,e);if(n)return n}else throw new li(`Unknown endpoint rule: ${r}`);throw new li("Rules evaluation failed")}});var ZWe=C(()=>{FJ();Gfe()});var Yz,QWe=C(()=>{Gz();Mh();ZWe();Yz=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${Rx} Initial EndpointParams: ${Th(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 li(`Missing required parameter: '${l}'`);let u=zJ(i,{endpointParams:r,logger:n,referenceRecord:{}});if(e.endpointParams?.Endpoint)try{let l=new URL(e.endpointParams.Endpoint),{protocol:c,port:d}=l;u.url.protocol=c,u.url.port=d}catch{}return e.logger?.debug?.(`${Rx} Resolved endpoint: ${Th(u)}`),u}});var KE=C(()=>{$fe();qfe();FJ();QWe();Mh()});var Kfe=C(()=>{KE()});var Yfe,eJe=C(()=>{KE();Kfe();Yfe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!Yfe(r))return!1;return!0}return!(!Jz(t)||t.length<3||t.length>63||t!==t.toLowerCase()||Wz(t))}});var tJe,wZt,rJe,nJe=C(()=>{tJe=":",wZt="/",rJe=t=>{let e=t.split(tJe);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(tJe)==="")return null;let u=s.map(l=>l.split(wZt)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var iJe,oJe=C(()=>{iJe={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 xZt,CZt,aJe,sJe,Xfe=C(()=>{oJe();xZt=iJe,CZt="",aJe=t=>{let{partitions:e}=xZt;for(let n of e){let{regions:o,outputs:i}=n;for(let[a,s]of Object.entries(o))if(a===t)return{...i,...s}}for(let n of e){let{regionRegex:o,outputs:i}=n;if(new RegExp(o).test(t))return{...i}}let r=e.find(n=>n.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},sJe=()=>CZt});var Xz,uJe=C(()=>{KE();eJe();nJe();Xfe();Xz={isVirtualHostableS3Bucket:Yfe,parseArn:rJe,partition:aJe};Ax.aws=Xz});var lJe=C(()=>{KE()});var cJe=C(()=>{KE()});var dJe=C(()=>{});var fJe=C(()=>{});var pJe=C(()=>{});var hJe=C(()=>{});var mJe=C(()=>{});var gJe=C(()=>{cJe();dJe();fJe();pJe();hJe();mJe()});var HJ=C(()=>{uJe();Xfe();Kfe();lJe();gJe()});var yJe=C(()=>{});var bJe=C(()=>{yJe()});var _Je=C(()=>{vs()});var vJe=C(()=>{});var wJe=C(()=>{});function OZt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var xR,SJe=C(()=>{xR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new xR({...e,headers:{...e.headers}});return r.query&&(r.query=OZt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return xR.clone(this)}}});var xJe=C(()=>{});var CJe=C(()=>{});var OJe=C(()=>{});var EJe=C(()=>{bJe();_Je();vJe();wJe();SJe();xJe();CJe();OJe()});var Zfe,VJ,Qfe,WJ,PJe,TJe,epe,MJe=C(()=>{Zfe="user-agent",VJ="x-amz-user-agent",Qfe=" ",WJ="/",PJe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,TJe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,epe="-"});var EZt,tpe,PZt,JJ,AJe=C(()=>{HJ();EJe();MJe();EZt=t=>(e,r)=>async n=>{let{request:o}=n;if(!xR.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(tpe)||[],s=(await t.defaultUserAgentProvider()).map(tpe),u=t?.customUserAgent?.map(tpe)||[],l=sJe(),c=(l?[l]:[]).concat([...s,...a,...u]).join(Qfe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(Qfe);return t.runtime!=="browser"?(d&&(i[VJ]=i[VJ]?`${i[Zfe]} ${d}`:d),i[Zfe]=c):i[VJ]=c,e({...n,request:o})},tpe=t=>{let e=t[0].split(WJ).map(a=>a.replace(PJe,epe)).join(WJ),r=t[1]?.replace(TJe,epe),n=e.indexOf(WJ),o=e.substring(0,n),i=e.substring(n+1);return o==="api"&&(i=i.toLowerCase()),[o,i,r].filter(a=>a&&a.length>0).reduce((a,s,u)=>{switch(u){case 0:return s;case 1:return`${a}/${s}`;default:return`${a}#${s}`}},"")},PZt={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},JJ=t=>({applyToStack:e=>{e.add(EZt(t),PZt)}})});var rpe=C(()=>{uWe();AJe()});var RJe=C(()=>{});var IJe=C(()=>{});var GJ,DJe=C(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(GJ||(GJ={}))});var npe=C(()=>{RJe();IJe();DJe()});var KJ,jJe=C(()=>{npe();KJ=!1});var YJ,NJe=C(()=>{npe();YJ=!1});var ib,LJe=C(()=>{vs();ib=t=>t[zN]||(t[zN]={})});var Zc,FJe=C(()=>{Zc=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var mg=C(()=>{LJe();FJe()});var kJe=C(()=>{mg()});var BJe=C(()=>{});var $Je=C(()=>{mg();BJe()});var qJe=C(()=>{jJe();NJe();kJe();$Je()});var UJe=C(()=>{});var XJ,ope=C(()=>{XJ=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var ipe,zJe=C(()=>{ope();ipe=t=>XJ(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var ZJ,HJe=C(()=>{zJe();ope();ZJ=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return ipe(e);let n=await e();return ipe(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return XJ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var VJe=C(()=>{UJe();HJe()});var WJe=C(()=>{});var JJe=C(()=>{});var GJe=C(()=>{});var KJe=C(()=>{});var YJe=C(()=>{});var XJe=C(()=>{});var ZJe=C(()=>{GJe();KJe();YJe();XJe()});var QJe=C(()=>{WJe();JJe();ZJe()});var Zz=C(()=>{qJe();VJe();QJe()});function MZt(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var ape,QJ=C(()=>{vs();mg();ape=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=MZt(t.httpAuthSchemes),s=ib(n),u=[];for(let l of i){let c=a.get(l.schemeId);if(!c){u.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}let d=c.identityProvider(await e.identityProviderConfigProvider(t));if(!d){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:f={},signingProperties:p={}}=l.propertiesExtractor?.(t,n)||{};l.identityProperties=Object.assign(l.identityProperties||{},f),l.signingProperties=Object.assign(l.signingProperties||{},p),s.selectedHttpAuthScheme={httpAuthOption:l,identity:await d(l.identityProperties),signer:c.signer};break}if(!s.selectedHttpAuthScheme)throw new Error(u.join(`
`));return r(o)}});var eGe,AZt,RZt,IZt,DZt,jZt,tGe=C(()=>{eGe=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),jZt(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!DZt(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},AZt=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,RZt=/(\d+\.){3}\d+/,IZt=/\.\./,DZt=t=>AZt.test(t)&&!RZt.test(t)&&!IZt.test(t),jZt=t=>{let[e,r,n,,,o]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,a=Boolean(i&&r&&n&&o);if(i&&!a)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return a}});var rGe=C(()=>{tGe()});var nGe,oGe=C(()=>{nGe=(t,e,r)=>{let n=async()=>{let o=r[t]??r[e];return typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:s,path:u}=o;return`${i}//${a}${s?":"+s:""}${u}`}}return o}:n}});var iGe,aGe=C(()=>{iGe=async t=>{}});function sGe(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[n,o=null]=r.split("=");n=decodeURIComponent(n),o&&(o=decodeURIComponent(o)),n in e?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o}return e}var uGe=C(()=>{});var YE,eG=C(()=>{uGe();YE=t=>{if(typeof t=="string")return YE(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=sGe(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var tG,rG=C(()=>{eG();tG=t=>typeof t=="object"?"url"in t?YE(t.url):t:YE(t)});var lGe,NZt,spe=C(()=>{rGe();oGe();aGe();rG();lGe=async(t,e,r,n)=>{if(!r.endpoint){let a=await iGe(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(tG(a)))}let o=await NZt(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},NZt=async(t,e,r)=>{let n={},o=e?.getEndpointParameterInstructions?.()||{};for(let[i,a]of Object.entries(o))switch(a.type){case"staticContextParams":n[i]=a.value;break;case"contextParams":n[i]=t[a.name];break;case"clientContextParams":case"builtInParams":n[i]=await nGe(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 eGe(n),n}});var cGe=C(()=>{spe();rG()});var dGe,upe=C(()=>{mg();spe();dGe=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await lGe(o.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;let a=n.authSchemes?.[0];if(a){n.signing_region=a.signingRegion,n.signing_service=a.signingName;let u=ib(n)?.selectedHttpAuthScheme?.httpAuthOption;u&&(u.signingProperties=Object.assign(u.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return r({...o})}});var fGe,lpe=C(()=>{fGe=(t,e)=>r=>async n=>{let{response:o}=await r(n);try{let i=await e(o,t);return{response:o,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:o}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=`
`+a,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}}});var pGe,cpe=C(()=>{pGe=(t,e)=>(r,n)=>async o=>{let i=n.endpointV2?.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(o.input,{...t,endpoint:i});return r({...o,request:a})}});function pt(t,e,r){return{applyToStack:n=>{n.add(fGe(t,r),LZt),n.add(pGe(t,e),Qz)}}}var LZt,Qz,hGe=C(()=>{lpe();cpe();LZt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Qz={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var On=C(()=>{lpe();hGe();cpe()});var dpe,ht,mGe=C(()=>{On();upe();dpe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Qz.name},ht=(t,e)=>({applyToStack:r=>{r.addRelativeTo(dGe({config:t,instructions:e}),dpe)}})});var nG,gGe=C(()=>{mg();rG();nG=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>tG(await Zc(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Zc(t.useDualstackEndpoint??!1),useFipsEndpoint:Zc(t.useFipsEndpoint??!1)}}});var yGe=C(()=>{});var bn=C(()=>{cGe();upe();mGe();gGe();yGe()});var FZt,oG,bGe=C(()=>{bn();QJ();FZt={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:dpe.name},oG=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(ape(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),FZt)}})});var aqn,_Ge=C(()=>{On();QJ();aqn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Qz.name}});var vGe=C(()=>{QJ();bGe();_Ge()});var wGe=C(()=>{});var SGe=C(()=>{wGe()});var xGe=C(()=>{vs()});var CGe=C(()=>{});var OGe=C(()=>{});function kZt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var ab,EGe=C(()=>{ab=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new ab({...e,headers:{...e.headers}});return r.query&&(r.query=kZt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return ab.clone(this)}}});var PGe=C(()=>{});var TGe=C(()=>{});var MGe=C(()=>{});var e2=C(()=>{SGe();xGe();CGe();OGe();EGe();PGe();TGe();MGe()});var BZt,$Zt,AGe,fpe=C(()=>{e2();vs();mg();BZt=t=>e=>{throw e},$Zt=(t,e)=>{},AGe=t=>(e,r)=>async n=>{if(!ab.isInstance(n.request))return e(n);let i=ib(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:a={}},identity:s,signer:u}=i,l=await e({...n,request:await u.sign(n.request,s,a)}).catch((u.errorHandler||BZt)(a));return(u.successHandler||$Zt)(l.response,a),l}});var gg,sb,t2,iG=C(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(gg||(gg={}));sb=3,t2=gg.STANDARD});var RGe,IGe,DGe,jGe,NGe=C(()=>{RGe=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],IGe=["TimeoutError","RequestTimeout","RequestTimeoutException"],DGe=[500,502,503,504],jGe=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var qZt,VN,aG,LGe,r2=C(()=>{NGe();qZt=t=>t.$metadata?.clockSkewCorrected,VN=t=>t.$metadata?.httpStatusCode===429||RGe.includes(t.name)||t.$retryable?.throttling==!0,aG=t=>qZt(t)||IGe.includes(t.name)||jGe.includes(t?.code||"")||DGe.includes(t.$metadata?.httpStatusCode||0),LGe=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!aG(t)}return!1}});var n2,ppe=C(()=>{r2();n2=class{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),VN(e)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var sG,uG,WN=C(()=>{sG="amz-sdk-invocation-id",uG="amz-sdk-request"});var FGe,kGe=C(()=>{WN();FGe=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var hpe,BGe=C(()=>{WN();hpe=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var CR,cG=C(()=>{iG();WN();kGe();BGe();CR=class{constructor(e){this.maxAttempts=e,this.mode=gg.STANDARD,this.capacity=500,this.retryBackoffStrategy=FGe(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return hpe({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,r){let n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){let o=r.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?500:100);let i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,s=this.getCapacityCost(o);return this.capacity-=s,hpe({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${sb}`),sb}}shouldRetry(e,r,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var dG,HGe=C(()=>{iG();ppe();cG();dG=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=gg.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new n2,this.standardRetryStrategy=new CR(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}});var VGe=C(()=>{WN();cG()});var WGe=C(()=>{});var ub=C(()=>{HGe();VGe();ppe();cG();iG();WN();WGe()});var JGe=C(()=>{});var GGe=C(()=>{JGe()});var KGe=C(()=>{vs()});var YGe=C(()=>{});var XGe=C(()=>{});function UZt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Ix,ZGe=C(()=>{Ix=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new Ix({...e,headers:{...e.headers}});return r.query&&(r.query=UZt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return Ix.clone(this)}}});var o2,QGe=C(()=>{o2=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var eKe=C(()=>{});var tKe=C(()=>{});var fG=C(()=>{GGe();KGe();YGe();XGe();ZGe();QGe();eKe();tKe()});function gpe(){if(!pG&&(pG=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pG))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pG(zZt)}var pG,zZt,rKe=C(()=>{zZt=new Uint8Array(16)});function nKe(t,e=0){return rc[t[e+0]]+rc[t[e+1]]+rc[t[e+2]]+rc[t[e+3]]+"-"+rc[t[e+4]]+rc[t[e+5]]+"-"+rc[t[e+6]]+rc[t[e+7]]+"-"+rc[t[e+8]]+rc[t[e+9]]+"-"+rc[t[e+10]]+rc[t[e+11]]+rc[t[e+12]]+rc[t[e+13]]+rc[t[e+14]]+rc[t[e+15]]}var rc,oKe=C(()=>{rc=[];for(let t=0;t<256;++t)rc.push((t+256).toString(16).slice(1))});var HZt,ype,iKe=C(()=>{HZt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ype={randomUUID:HZt}});function VZt(t,e,r){if(ype.randomUUID&&!e&&!t)return ype.randomUUID();t=t||{};let n=t.random||(t.rng||gpe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return nKe(n)}var bpe,aKe=C(()=>{iKe();rKe();oKe();bpe=VZt});var sKe=C(()=>{aKe()});var uKe=C(()=>{ub()});var _pe=C(()=>{ub()});var vpe=C(()=>{r2()});var wpe,Spe=C(()=>{wpe=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});var xpe=C(()=>{fG();r2();ub();uKe();_pe();vpe();Spe()});var lKe=C(()=>{ub();xpe()});var hG,cKe=C(()=>{mg();ub();hG=t=>{let{retryStrategy:e}=t,r=Zc(t.maxAttempts??sb);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Zc(t.retryMode)()===gg.ADAPTIVE?new dG(r):new CR(r))}}});var dKe=C(()=>{fG();ub()});var XE,fKe=C(()=>{XE=class{trace(){}debug(){}info(){}warn(){}error(){}}});var OR,ZE,GN,pKe,hKe,mKe=C(()=>{OR=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},ZE=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,GN=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>pKe[p.step]-pKe[f.step]||hKe[p.priority||"normal"]-hKe[f.priority||"normal"]),i=d=>{let f=!1,p=h=>{let m=OR(h.name,h.aliases);if(m.includes(d)){f=!0;for(let v of m)n.delete(v);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=h=>{if(h.middleware===d){f=!0;for(let m of OR(h.name,h.aliases))n.delete(m);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],h={};return t.forEach(v=>{let g={...v,before:[],after:[]};for(let _ of OR(g.name,g.aliases))h[_]=g;f.push(g)}),e.forEach(v=>{let g={...v,before:[],after:[]};for(let _ of OR(g.name,g.aliases))h[_]=g;p.push(g)}),p.forEach(v=>{if(v.toMiddleware){let g=h[v.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${v.toMiddleware} is not found when adding ${ZE(v.name,v.aliases)} middleware ${v.relation} ${v.toMiddleware}`)}v.relation==="after"&&g.after.push(v),v.relation==="before"&&g.before.push(v)}}),o(f).map(u).reduce((v,g)=>(v.push(...g),v),[])},c={add:(d,f={})=>{let{name:p,override:h,aliases:m}=f,v={step:"initialize",priority:"normal",middleware:d,...f},g=OR(p,m);if(g.length>0){if(g.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${ZE(p,m)}'`);for(let _ of g){let S=t.findIndex(O=>O.name===_||O.aliases?.some(T=>T===_));if(S===-1)continue;let x=t[S];if(x.step!==v.step||v.priority!==x.priority)throw new Error(`"${ZE(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${ZE(p,m)}" middleware with ${v.priority} priority in ${v.step} step.`);t.splice(S,1)}}for(let _ of g)n.add(_)}t.push(v)},addRelativeTo:(d,f)=>{let{name:p,override:h,aliases:m}=f,v={middleware:d,...f},g=OR(p,m);if(g.length>0){if(g.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${ZE(p,m)}'`);for(let _ of g){let S=e.findIndex(O=>O.name===_||O.aliases?.some(T=>T===_));if(S===-1)continue;let x=e[S];if(x.toMiddleware!==v.toMiddleware||x.relation!==v.relation)throw new Error(`"${ZE(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${ZE(p,m)}" middleware ${v.relation} "${v.toMiddleware}" middleware.`);e.splice(S,1)}}for(let _ of g)n.add(_)}e.push(v)},clone:()=>s(GN()),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:v,aliases:g}=h;if(m&&m.includes(d)){let _=OR(v,g);for(let S of _)n.delete(S);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(GN());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 ZE(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},pKe={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},hKe={high:3,normal:2,low:1}});var Cpe=C(()=>{mKe()});var ER,gKe=C(()=>{Cpe();ER=class{constructor(e){this.middlewareStack=GN(),this.config=e}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)a(e).then(s=>i(null,s.output),s=>i(s)).catch(()=>{});else return a(e).then(s=>s.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}});var Dx,PR,QE,TR,yKe,Ope=C(()=>{Dx={},PR=new Array(64);for(let t=0,e="A".charCodeAt(0),r="Z".charCodeAt(0);t+e<=r;t++){let n=String.fromCharCode(t+e);Dx[n]=t,PR[t]=n}for(let t=0,e="a".charCodeAt(0),r="z".charCodeAt(0);t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;Dx[n]=o,PR[o]=n}for(let t=0;t<10;t++){Dx[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;Dx[e]=r,PR[r]=e}Dx["+"]=62;PR[62]="+";Dx["/"]=63;PR[63]="/";QE=6,TR=8,yKe=63});var eP,bKe=C(()=>{Ope();eP=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;let r=new ArrayBuffer(e),n=new DataView(r);for(let o=0;o<t.length;o+=4){let i=0,a=0;for(let l=o,c=o+3;l<=c;l++)if(t[l]!=="="){if(!(t[l]in Dx))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=Dx[t[l]]<<(c-l)*QE,a+=QE}else i>>=QE;let s=o/4*3;i>>=a%TR;let u=Math.floor(a/TR);for(let l=0;l<u;l++){let c=(u-l-1)*TR;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var Epe,Ppe=C(()=>{Epe=t=>new TextEncoder().encode(t)});var _Ke=C(()=>{Ppe()});var vKe=C(()=>{});var wKe=C(()=>{Ppe();_Ke();vKe()});function tP(t){let e;typeof t=="string"?e=Epe(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let i=0;i<e.length;i+=3){let a=0,s=0;for(let l=i,c=Math.min(i+3,e.length);l<c;l++)a|=e[l]<<(c-l-1)*TR,s+=TR;let u=Math.ceil(s/QE);a<<=u*QE-s;for(let l=1;l<=u;l++){let c=(u-l)*QE;o+=PR[(a&yKe<<c)>>c]}o+="==".slice(0,4-u)}return o}var SKe=C(()=>{wKe();Ope()});var KN=C(()=>{bKe();SKe()});var Tpe,Mpe=C(()=>{Tpe=t=>new TextEncoder().encode(t)});var xKe=C(()=>{Mpe()});var mG,CKe=C(()=>{mG=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var Ape=C(()=>{Mpe();xKe();CKe()});function OKe(t,e="utf-8"){return e==="base64"?tP(t):mG(t)}function EKe(t,e){return e==="base64"?yg.mutate(eP(t)):yg.mutate(Tpe(t))}var PKe=C(()=>{KN();Ape();Rpe()});var yg,Rpe=C(()=>{PKe();yg=class extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return EKe(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,yg.prototype),e}transformToString(e="utf-8"){return OKe(this,e)}}});var TKe=C(()=>{});var MKe=C(()=>{});var AKe=C(()=>{MKe()});var RKe=C(()=>{vs()});var IKe=C(()=>{});var DKe=C(()=>{});var jKe=C(()=>{});var i2,NKe=C(()=>{i2=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var LKe=C(()=>{});var FKe=C(()=>{});var kKe=C(()=>{AKe();RKe();IKe();DKe();jKe();NKe();LKe();FKe()});var Ah,WZt,Ipe=C(()=>{Ah=t=>encodeURIComponent(t).replace(/[!'()*]/g,WZt),WZt=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var BKe=C(()=>{Ipe()});var gG=C(()=>{Ipe();BKe()});function $Ke(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Ah(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${Ah(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${Ah(n)}`),e.push(o)}}return e.join("&")}var qKe=C(()=>{gG()});function UKe(t=0){return new Promise((e,r)=>{t&&setTimeout(()=>{let n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}var zKe=C(()=>{});var Dpe,lb,HKe=C(()=>{kKe();qKe();zKe();Dpe={supported:void 0},lb=class{static create(e){return typeof e?.handle=="function"?e:new lb(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Dpe.supported===void 0&&(Dpe.supported=Boolean(typeof Request<"u"&&"keepalive"in new Request("https://[::1]")))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=$Ke(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",_=e.password??"";u=`${g}:${_}@`}let{port:l,method:c}=e,d=`${e.protocol}//${u}${e.hostname}${l?`:${l}`:""}${a}`,f=c==="GET"||c==="HEAD"?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:c,credentials:i};f&&(p.duplex="half"),typeof AbortController<"u"&&(p.signal=r),Dpe.supported&&(p.keepalive=o);let h=()=>{},m=new Request(d,p),v=[fetch(m).then(g=>{let _=g.headers,S={};for(let O of _.entries())S[O[0]]=O[1];return g.body!=null?{response:new i2({headers:S,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new i2({headers:S,reason:g.statusText,statusCode:g.status,body:O})}))}),UKe(n)];return r&&v.push(new Promise((g,_)=>{let S=()=>{let x=new Error("Request aborted");x.name="AbortError",_(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(v).finally(h)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function JZt(t){let e=await KZt(t),r=eP(e);return new Uint8Array(r)}async function GZt(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:s,value:u}=await r.read();u&&(e.push(u),o+=u.length),n=s}let i=new Uint8Array(o),a=0;for(let s of e)i.set(s,a),a+=s.length;return i}function KZt(t){return new Promise((e,r)=>{let n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));let o=n.result??"",i=o.indexOf(","),a=i>-1?i+1:o.length;e(o.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}var YN,VKe=C(()=>{KN();YN=t=>typeof Blob=="function"&&t instanceof Blob?JZt(t):GZt(t)});var a2=C(()=>{HKe();VKe()});function JKe(t){let e="";for(let r=0;r<t.byteLength;r++)e+=WKe[t[r]];return e}var WKe,YZt,GKe=C(()=>{WKe={},YZt={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),WKe[t]=e,YZt[e]=t}});var jpe,Npe=C(()=>{jpe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var KKe,XKe,YKe,ZKe=C(()=>{a2();KN();GKe();Ape();Npe();KKe="The stream has already been transformed.",XKe=t=>{if(!YKe(t)&&!jpe(t)){let o=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`)}let e=!1,r=async()=>{if(e)throw new Error(KKe);return e=!0,await YN(t)},n=o=>{if(typeof o.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return o.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let i=await r();if(o==="base64")return tP(i);if(o==="hex")return JKe(i);if(o===void 0||o==="utf8"||o==="utf-8")return mG(i);if(typeof TextDecoder=="function")return new TextDecoder(o).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(KKe);if(e=!0,YKe(t))return n(t);if(jpe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},YKe=t=>typeof Blob=="function"&&t instanceof Blob});var QKe=C(()=>{});var e7e=C(()=>{});var Lpe=C(()=>{Rpe();TKe();ZKe();QKe();e7e();Npe()});var rP,t7e=C(()=>{Lpe();rP=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return yg.mutate(t);if(!t)return yg.mutate(new Uint8Array);let r=e.streamCollector(t);return yg.mutate(await r)}});var it,Fpe,r7e=C(()=>{Cpe();vs();it=class{constructor(){this.middlewareStack=GN()}static classBuilder(){return new Fpe}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let v of o.bind(this)(d,e,r,n))this.middlewareStack.use(v);let f=e.concat(this.middlewareStack),{logger:p}=r,h={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[zN]:{commandInstance:this,...l},...c},{requestHandler:m}=r;return f.resolve(v=>m.handle(v.request,n||{}),h)}},Fpe=class{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,r;return r=class extends it{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,o,i){return this.resolveMiddlewareWithContext(n,o,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var yG,n7e=C(()=>{yG="***SensitiveInformation***"});var bG,o7e=C(()=>{bG=(t,e)=>{for(let r of Object.keys(t)){let n=t[r],o=async function(a,s,u){let l=new n(a);if(typeof s=="function")this.send(l,s);else if(typeof u=="function"){if(typeof s!="object")throw new Error(`Expected http options but got ${typeof s}`);this.send(l,s||{},u)}else return this.send(l,s)},i=(r[0].toLowerCase()+r.slice(1)).replace(/Command$/,"");e.prototype[i]=o}}});var MR,XZt,i7e,ZZt,a7e,s7e,u7e,kpe,QZt,XN,Nr,l7e,c7e,eQt,s2,u2,Bpe,d7e,f7e,p7e,$pe=C(()=>{MR=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&p7e.warn(f7e(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},XZt=Math.ceil(34028234663852886e22),i7e=t=>{let e=MR(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>XZt)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},ZZt=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},a7e=t=>kpe(t,32),s7e=t=>kpe(t,16),u7e=t=>kpe(t,8),kpe=(t,e)=>{let r=ZZt(t);if(r!==void 0&&QZt(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},QZt=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},XN=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},Nr=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return p7e.warn(f7e(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},l7e=t=>MR(typeof t=="string"?s2(t):t),c7e=t=>i7e(typeof t=="string"?s2(t):t),eQt=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,s2=t=>{let e=t.match(eQt);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},u2=t=>a7e(typeof t=="string"?s2(t):t),Bpe=t=>s7e(typeof t=="string"?s2(t):t),d7e=t=>u7e(typeof t=="string"?s2(t):t),f7e=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),p7e={warn:console.warn}});var tQt,rQt,h7e,nQt,m7e,l4n,c4n,d4n,_G,g7e,f4n,oQt,iQt,aQt,AR,sQt,uQt,qpe,y7e=C(()=>{$pe();tQt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rQt=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),h7e=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=rQt.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=Bpe(qpe(n)),d=AR(o,"month",1,12),f=AR(i,"day",1,31);return g7e(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},nQt=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),m7e=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=nQt.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l,c]=e,d=Bpe(qpe(n)),f=AR(o,"month",1,12),p=AR(i,"day",1,31),h=g7e(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&h.setTime(h.getTime()-uQt(c)),h},l4n=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$/),c4n=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$/),d4n=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})$/),_G=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=l7e(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},g7e=(t,e,r,n)=>{let o=e-1;return iQt(t,o,r),new Date(Date.UTC(t,o,r,AR(n.hours,"hour",0,23),AR(n.minutes,"minute",0,59),AR(n.seconds,"seconds",0,60),sQt(n.fractionalMilliseconds)))},f4n=50*365*24*60*60*1e3,oQt=[31,28,31,30,31,30,31,31,30,31,30,31],iQt=(t,e,r)=>{let n=oQt[e];if(e===1&&aQt(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${tQt[e]} in ${t}: ${r}`)},aQt=t=>t%4===0&&(t%100!==0||t%400===0),AR=(t,e,r,n)=>{let o=d7e(qpe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},sQt=t=>t==null?0:c7e("0."+t)*1e3,uQt=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let n=Number(t.substring(1,3)),o=Number(t.substring(4,6));return r*(n*60+o)*60*1e3},qpe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var nP,ca,Upe=C(()=>{nP=class extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,nP.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}},ca=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,o])=>{(t[n]==null||t[n]==="")&&(t[n]=o)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t}});var lQt,vG,cQt,b7e=C(()=>{Upe();lQt=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=cQt(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ca(a,e)},vG=t=>({output:e,parsedBody:r,errorCode:n})=>{lQt({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},cQt=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]})});var wG,_7e=C(()=>{wG=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}}});var v7e=C(()=>{});var w7e,S7e,x7e=C(()=>{vs();w7e=t=>{let e=[];for(let r in UN){let n=UN[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},S7e=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var C7e,O7e,E7e=C(()=>{C7e=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},O7e=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var SG,xG,P7e=C(()=>{x7e();E7e();SG=t=>({...w7e(t),...C7e(t)}),xG=t=>({...S7e(t),...O7e(t)})});var T7e=C(()=>{P7e()});function CG(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var zpe=C(()=>{});var M7e=C(()=>{});var Hpe,A7e=C(()=>{Hpe=t=>{let e="#text";for(let r in t)t.hasOwnProperty(r)&&t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=Hpe(t[r]));return t}});var Vpe,R7e=C(()=>{Vpe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};Vpe.prototype=Object.create(String.prototype,{constructor:{value:Vpe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Vpe,String)});var l2,dQt,fQt,pQt,I7e=C(()=>{l2=(t,e)=>{let r={};for(let n in e)dQt(r,t,e,n);return r},dQt=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=fQt,u=pQt,l=n]=a;(typeof s=="function"&&s(e[l])||typeof s!="function"&&s)&&(t[n]=u(e[l]));return}let[o,i]=r[n];if(typeof i=="function"){let a,s=o===void 0&&(a=i())!=null,u=typeof o=="function"&&!!o(void 0)||typeof o!="function"&&!!o;s?t[n]=a:u&&(t[n]=i())}else{let a=o===void 0&&i!=null,s=typeof o=="function"&&!!o(i)||typeof o!="function"&&!!o;(a||s)&&(t[n]=i)}},fQt=t=>t!=null,pQt=t=>t});var D7e=C(()=>{zpe()});var j7e=C(()=>{});var It,N7e=C(()=>{It=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(It);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=It(t[r]));return e}return t}});var L7e=C(()=>{});var Dt=C(()=>{fKe();gKe();t7e();r7e();n7e();o7e();y7e();b7e();_7e();v7e();T7e();Upe();zpe();M7e();A7e();R7e();I7e();$pe();D7e();j7e();N7e();L7e()});var F7e,k7e=C(()=>{F7e=t=>t?.body instanceof ReadableStream});var hQt,mQt,gQt,yQt,Wpe,OG,bQt,B7e=C(()=>{fG();r2();Dt();ub();sKe();k7e();Spe();hQt=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(mQt(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=Ix.isInstance(c);for(d&&(c.headers[sG]=bpe());;)try{d&&(c.headers[uG]=`attempt=${u+1}; max=${i}`);let{response:f,output:p}=await e(n);return o.recordSuccess(a),p.$metadata.attempts=u+1,p.$metadata.totalRetryDelay=l,{response:f,output:p}}catch(f){let p=gQt(f);if(s=wpe(f),d&&F7e(c))throw(r.logger instanceof XE?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let h=a.getRetryDelay();l+=h,await new Promise(m=>setTimeout(m,h))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},mQt=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",gQt=t=>{let e={error:t,errorType:yQt(t)},r=bQt(t.$response);return r&&(e.retryAfterHint=r),e},yQt=t=>VN(t)?"THROTTLING":aG(t)?"TRANSIENT":LGe(t)?"SERVER_ERROR":"CLIENT_ERROR",Wpe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},OG=t=>({applyToStack:e=>{e.add(hQt(t),Wpe)}}),bQt=t=>{if(!o2.isInstance(t))return;let e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)}});var EG=C(()=>{lKe();xpe();cKe();_pe();dKe();vpe();B7e()});var _Qt,PG,$7e=C(()=>{EG();fpe();_Qt={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Wpe.name},PG=t=>({applyToStack:e=>{e.addRelativeTo(AGe(t),_Qt)}})});var q7e=C(()=>{fpe();$7e()});var ZN,U7e=C(()=>{ZN=class{constructor(e){this.authSchemes=new Map;for(let[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}});var z7e=C(()=>{e2();vs()});var H7e=C(()=>{e2()});var QN,V7e=C(()=>{QN=class{async sign(e,r,n){return e}}});var W7e=C(()=>{z7e();H7e();V7e()});var vQt,J7e,Jpe,G7e,K7e=C(()=>{vQt=t=>e=>Jpe(e)&&e.expiration.getTime()-Date.now()<t,J7e=vQt(3e5),Jpe=t=>t.expiration!==void 0,G7e=(t,e,r)=>{if(t===void 0)return;let n=typeof t!="function"?async()=>Promise.resolve(t):t,o,i,a,s=!1,u=async l=>{i||(i=n(l));try{o=await i,a=!0,s=!1}finally{i=void 0}return o};return e===void 0?async l=>((!a||l?.forceRefresh)&&(o=await u(l)),o):async l=>((!a||l?.forceRefresh)&&(o=await u(l)),s?o:r(o)?(e(o)&&await u(l),o):(s=!0,o))}});var Y7e=C(()=>{U7e();W7e();K7e()});var X7e=C(()=>{vs()});var eL,Z7e=C(()=>{eL=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Q7e=C(()=>{e2();Dt()});function Gpe(t,e,r,n,o){return async function*(a,s,...u){let l=a.startingToken||void 0,c=!0,d;for(;c;){if(s[r]=l,o&&(s[o]=s[o]??a.pageSize),a.client instanceof t)d=await wQt(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=SQt(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var wQt,SQt,eYe=C(()=>{wQt=async(t,e,r,...n)=>await e.send(new t(r),...n);SQt=(t,e)=>{let r=t,n=e.split(".");for(let o of n){if(!r||typeof r!="object")return;r=r[o]}return r}});var oP=C(()=>{vGe();q7e();Y7e();X7e();Z7e();Q7e();eYe()});var tYe=C(()=>{});var rYe=C(()=>{tYe()});var nYe=C(()=>{vs()});var oYe=C(()=>{});var iYe=C(()=>{});function xQt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var RR,aYe=C(()=>{RR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new RR({...e,headers:{...e.headers}});return r.query&&(r.query=xQt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return RR.clone(this)}}});var sYe=C(()=>{});var uYe=C(()=>{});var lYe=C(()=>{});var cYe=C(()=>{rYe();nYe();oYe();iYe();aYe();sYe();uYe();lYe()});function CQt(t){return e=>async r=>{let n=r.request;if(RR.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(dYe)===-1)try{let a=t(o);n.headers={...n.headers,[dYe]:String(a)}}catch{}}return e({...r,request:n})}}var dYe,OQt,TG,Kpe=C(()=>{cYe();dYe="content-length";OQt={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},TG=t=>({applyToStack:e=>{e.add(CQt(t.bodyLengthChecker),OQt)}})});var fYe=C(()=>{});var pYe=C(()=>{fYe()});var hYe=C(()=>{});var mYe=C(()=>{hYe()});var gYe=C(()=>{vs()});var yYe=C(()=>{});var bYe=C(()=>{});function EQt(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var bg,_Ye=C(()=>{bg=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new bg({...e,headers:{...e.headers}});return r.query&&(r.query=EQt(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return bg.clone(this)}}});var MG,vYe=C(()=>{MG=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var wYe=C(()=>{});var SYe=C(()=>{});var c2=C(()=>{mYe();gYe();yYe();bYe();_Ye();vYe();wYe();SYe()});var Ype,xYe=C(()=>{c2();Ype=t=>MG.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var AG,Xpe=C(()=>{AG=t=>new Date(Date.now()+t)});var CYe,OYe=C(()=>{Xpe();CYe=(t,e)=>Math.abs(AG(e).getTime()-t)>=3e5});var Zpe,EYe=C(()=>{OYe();Zpe=(t,e)=>{let r=Date.parse(t);return CYe(r,e)?r-Date.now():e}});var PYe=C(()=>{xYe();Xpe();EYe()});var d2,TYe,IR,MYe=C(()=>{c2();PYe();d2=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},TYe=async t=>{let e=d2("context",t.context),r=d2("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await d2("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},IR=class{async sign(e,r,n){if(!bg.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await TYe(n),{config:i,signer:a}=o,{signingRegion:s,signingName:u}=o,l=n.context;if(l?.authSchemes?.length??0>1){let[d,f]=l.authSchemes;d?.name==="sigv4a"&&f?.name==="sigv4"&&(s=f?.signingRegion??s,u=f?.signingName??u)}return await a.sign(e,{signingDate:AG(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??Ype(r.$response);if(n){let o=d2("config",e.config),i=o.systemClockOffset;o.systemClockOffset=Zpe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=Ype(e);if(n){let o=d2("config",r.config);o.systemClockOffset=Zpe(n,o.systemClockOffset)}}}});var AYe=C(()=>{oP();Mx()});function IYe(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in Qpe)e[r/2]=Qpe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function _g(t){let e="";for(let r=0;r<t.byteLength;r++)e+=RYe[t[r]];return e}var RYe,Qpe,f2=C(()=>{RYe={},Qpe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),RYe[t]=e,Qpe[e]=t}});var p2,ehe=C(()=>{p2=t=>new TextEncoder().encode(t)});var iP,DYe=C(()=>{ehe();iP=t=>typeof t=="string"?p2(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var jYe=C(()=>{});var h2=C(()=>{ehe();DYe();jYe()});var NYe,LYe,the,FYe,kYe,rhe,nhe,ohe,ihe,PQt,BYe,$Ye,m2,qYe,UYe,zYe,HYe,RG,VYe,WYe,JYe,ahe,GYe,DR=C(()=>{NYe="X-Amz-Algorithm",LYe="X-Amz-Credential",the="X-Amz-Date",FYe="X-Amz-SignedHeaders",kYe="X-Amz-Expires",rhe="X-Amz-Signature",nhe="X-Amz-Security-Token",ohe="authorization",ihe=the.toLowerCase(),PQt="date",BYe=[ohe,ihe,PQt],$Ye=rhe.toLowerCase(),m2="x-amz-content-sha256",qYe=nhe.toLowerCase(),UYe={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},zYe=/^proxy-/,HYe=/^sec-/,RG="AWS4-HMAC-SHA256",VYe="AWS4-HMAC-SHA256-PAYLOAD",WYe="UNSIGNED-PAYLOAD",JYe=50,ahe="aws4_request",GYe=60*60*24*7});var IG,she,DG,YYe,KYe,uhe=C(()=>{f2();h2();DR();IG={},she=[],DG=(t,e,r)=>`${t}/${e}/${r}/${ahe}`,YYe=async(t,e,r,n,o)=>{let i=await KYe(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${_g(i)}:${e.sessionToken}`;if(a in IG)return IG[a];for(she.push(a);she.length>JYe;)delete IG[she.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,ahe])s=await KYe(t,s,u);return IG[a]=s},KYe=(t,e,r)=>{let n=new t(e);return n.update(iP(r)),n.digest()}});var jG,lhe=C(()=>{DR();jG=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in UYe||e?.has(i)||zYe.test(i)||HYe.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var che,dhe=C(()=>{gG();DR();che=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===$Ye)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Ah(n)}=${Ah(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Ah(n)}=${Ah(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var XYe,ZYe=C(()=>{XYe=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var g2,fhe=C(()=>{ZYe();f2();h2();DR();g2=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===m2)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||XYe(e)){let n=new r;return n.update(iP(e)),_g(await n.digest())}return WYe}});function eXe(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var NG,QYe,TQt,y2,tXe=C(()=>{f2();h2();NG=class{format(e){let r=[];for(let i of Object.keys(e)){let a=p2(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=p2(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(y2.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!TQt.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(IYe(e.value.replace(/\-/g,"")),1),d}}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(QYe||(QYe={}));TQt=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,y2=class{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&eXe(r),new y2(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&eXe(e),parseInt(_g(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var rXe,nXe=C(()=>{rXe=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var phe,hhe=C(()=>{c2();phe=(t,e={})=>{let{headers:r,query:n={}}=bg.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var LG,mhe=C(()=>{c2();DR();LG=t=>{t=bg.clone(t);for(let e of Object.keys(t.headers))BYe.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var oXe,MQt,iXe=C(()=>{oXe=t=>MQt(t).toISOString().replace(/\.\d{3}Z$/,"Z"),MQt=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var b2,FG,aXe,sXe=C(()=>{f2();mg();gG();h2();DR();uhe();lhe();dhe();fhe();tXe();nXe();hhe();mhe();iXe();b2=class{constructor({applyChecksum:e,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 e=="boolean"?e:!0,this.regionProvider=Zc(n),this.credentialProvider=Zc(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=FG(n);if(o>GYe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=DG(p,d,l??this.service),m=phe(LG(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[nhe]=c.sessionToken),m.query[NYe]=RG,m.query[LYe]=`${c.accessKeyId}/${h}`,m.query[the]=f,m.query[kYe]=o.toString(10);let v=jG(m,i,s);return m.query[FYe]=aXe(v),m.query[rhe]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,v,await g2(e,this.sha256))),m}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=FG(n),c=DG(u,s,a??this.service),d=await g2({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=_g(await f.digest()),h=[VYe,l,c,o,p,d].join(`
`);return this.signString(h,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=FG(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(iP(e)),_g(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=LG(e),{longDate:c,shortDate:d}=FG(r),f=DG(d,u,a??this.service);l.headers[ihe]=c,s.sessionToken&&(l.headers[qYe]=s.sessionToken);let p=await g2(l,this.sha256);!rXe(m2,l.headers)&&this.applyChecksum&&(l.headers[m2]=p);let h=jG(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[ohe]=`${RG} Credential=${s.accessKeyId}/${f}, SignedHeaders=${aXe(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${che(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(iP(n));let i=await o.digest();return`${RG}
${e}
${r}
${_g(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return Ah(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update(iP(i)),_g(await a.digest())}getSigningKey(e,r,n,o){return YYe(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}},FG=t=>{let e=oXe(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},aXe=t=>Object.keys(t).sort().join(";")});var uXe=C(()=>{sXe();lhe();dhe();fhe();hhe();mhe();uhe()});var kG,lXe=C(()=>{oP();uXe();kG=t=>{let e;t.credentials&&(e=G7e(t.credentials,J7e,Jpe)),e||(t.credentialDefaultProvider?e=eL(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});let{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:o}=t,i;return t.signer?i=eL(t.signer):t.regionInfoProvider?i=()=>eL(t.region)().then(async a=>[await t.regionInfoProvider(a,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},a]).then(([a,s])=>{let{signingRegion:u,signingService:l}=a;t.signingRegion=t.signingRegion||u||s,t.signingName=t.signingName||l||t.serviceId;let c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},d=t.signerConstructor||b2;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await eL(t.region)(),properties:{}},a);let s=a.signingRegion,u=a.signingName;t.signingRegion=t.signingRegion||s,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},c=t.signerConstructor||b2;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var cXe=C(()=>{MYe();AYe();lXe()});var dXe=C(()=>{cXe()});var fXe=C(()=>{});var pXe=C(()=>{Dt()});var BG,ghe=C(()=>{Dt();BG=(t,e)=>rP(t,e).then(r=>e.utf8Encoder(r))});var os,hXe,mXe,gXe=C(()=>{ghe();os=(t,e)=>BG(t,e).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),hXe=async(t,e)=>{let r=await os(t,e);return r.message=r.message??r.Message,r},mXe=(t,e)=>{let r=(i,a)=>Object.keys(i).find(s=>s.toLowerCase()===a.toLowerCase()),n=i=>{let a=i;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},o=r(t.headers,"x-amzn-errortype");if(o!==void 0)return n(t.headers[o]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)}});var $G=b(jx=>{"use strict";var yXe=":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",AQt=yXe+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",bXe="["+yXe+"]["+AQt+"]*",RQt=new RegExp("^"+bXe+"$"),IQt=function(t,e){let r=[],n=e.exec(t);for(;n;){let o=[];o.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let a=0;a<i;a++)o.push(n[a]);r.push(o),n=e.exec(t)}return r},DQt=function(t){let e=RQt.exec(t);return!(e===null||typeof e>"u")};jx.isExist=function(t){return typeof t<"u"};jx.isEmptyObject=function(t){return Object.keys(t).length===0};jx.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i<o;i++)r==="strict"?t[n[i]]=[e[n[i]]]:t[n[i]]=e[n[i]]}};jx.getValue=function(t){return jx.isExist(t)?t:""};jx.isName=DQt;jx.getAllMatches=IQt;jx.nameRegexp=bXe});var bhe=b(xXe=>{"use strict";var yhe=$G(),jQt={allowBooleanAttributes:!1,unpairedTags:[]};xXe.validate=function(t,e){e=Object.assign({},jQt,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=vXe(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=wXe(t,i);continue}else{let s=!1;t[i]==="/"&&(s=!0,i++);let u="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!UQt(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",is("InvalidTag",d,kd(t,i))}let l=FQt(t,i);if(l===!1)return is("InvalidAttr","Attributes for '"+u+"' have open quote.",kd(t,i));let c=l.value;if(i=l.index,c[c.length-1]==="/"){let d=i-c.length;c=c.substring(0,c.length-1);let f=SXe(c,e);if(f===!0)n=!0;else return is(f.err.code,f.err.msg,kd(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return is("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",kd(t,a));if(r.length===0)return is("InvalidTag","Closing tag '"+u+"' has not been opened.",kd(t,a));{let d=r.pop();if(u!==d.tagName){let f=kd(t,d.tagStartPos);return is("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",kd(t,a))}r.length==0&&(o=!0)}}else return is("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",kd(t,i));else{let d=SXe(c,e);if(d!==!0)return is(d.err.code,d.err.msg,kd(t,i-c.length+d.err.line));if(o===!0)return is("InvalidXml","Multiple possible root nodes found.",kd(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=wXe(t,i);continue}else if(t[i+1]==="?"){if(i=vXe(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=$Qt(t,i);if(d==-1)return is("InvalidChar","char '&' is not expected.",kd(t,i));i=d}else if(o===!0&&!_Xe(t[i]))return is("InvalidXml","Extra text at the end",kd(t,i));t[i]==="<"&&i--}}else{if(_Xe(t[i]))continue;return is("InvalidChar","char '"+t[i]+"' is not expected.",kd(t,i))}if(n){if(r.length==1)return is("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",kd(t,r[0].tagStartPos));if(r.length>0)return is("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return is("InvalidXml","Start tag expected.",1);return!0};function _Xe(t){return t===" "||t===" "||t===`
`||t==="\r"}function vXe(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return is("InvalidXml","XML declaration allowed only at the start of the document.",kd(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function wXe(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var NQt='"',LQt="'";function FQt(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===NQt||t[e]===LQt)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var kQt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function SXe(t,e){let r=yhe.getAllMatches(t,kQt),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return is("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",_2(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return is("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",_2(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return is("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",_2(r[o]));let i=r[o][2];if(!qQt(i))return is("InvalidAttr","Attribute '"+i+"' is an invalid name.",_2(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return is("InvalidAttr","Attribute '"+i+"' is repeated.",_2(r[o]))}return!0}function BQt(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function $Qt(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,BQt(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function is(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function qQt(t){return yhe.isName(t)}function UQt(t){return yhe.isName(t)}function kd(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function _2(t){return t.startIndex+t[1].length}});var OXe=b(_he=>{var CXe={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},zQt=function(t){return Object.assign({},CXe,t)};_he.buildOptions=zQt;_he.defaultOptions=CXe});var PXe=b((L6n,EXe)=>{"use strict";var vhe=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]}):this.child.push({[e.tagname]:e.child})}};EXe.exports=vhe});var MXe=b((F6n,TXe)=>{var HQt=$G();function VQt(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,o=!1,i=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!i){if(o&&GQt(t,e))e+=7,[entityName,val,e]=WQt(t,e+1),val.indexOf("&")===-1&&(r[ZQt(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&KQt(t,e))e+=8;else if(o&&YQt(t,e))e+=8;else if(o&&XQt(t,e))e+=9;else if(JQt)i=!0;else throw new Error("Invalid DOCTYPE");n++,a=""}else if(t[e]===">"){if(i?t[e-1]==="-"&&t[e-2]==="-"&&(i=!1,n--):n--,n===0)break}else t[e]==="["?o=!0:a+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function WQt(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=t[e++],o="";for(;e<t.length&&t[e]!==n;e++)o+=t[e];return[r,o,e]}function JQt(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function GQt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function KQt(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function YQt(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function XQt(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function ZQt(t){if(HQt.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}TXe.exports=VQt});var RXe=b((k6n,AXe)=>{var QQt=/^[-+]?0x[a-fA-F0-9]+$/,eer=/^([\-\+])?(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 ter={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function rer(t,e={}){if(e=Object.assign({},ter,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&QQt.test(r))return Number.parseInt(r,16);{let n=eer.exec(r);if(n){let o=n[1],i=n[2],a=ner(n[3]),s=n[4]||n[6];if(!e.leadingZeros&&i.length>0&&o&&r[2]!==".")return t;if(!e.leadingZeros&&i.length>0&&!o&&r[1]!==".")return t;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||s?e.eNotation?u:t:r.indexOf(".")!==-1?l==="0"&&a===""||l===a||o&&l==="-"+a?u:t:i?a===l||o+a===l?u:t:r===l||r===o+l?u:t}}else return t}}function ner(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}AXe.exports=rer});var jXe=b((B6n,DXe)=>{"use strict";var IXe=$G(),v2=PXe(),oer=MXe(),ier=RXe(),whe=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=aer,this.parseXml=der,this.parseTextData=ser,this.resolveNameSpace=uer,this.buildAttributesMap=cer,this.isItStopNode=mer,this.replaceEntitiesValue=per,this.readStopNodeData=yer,this.saveTextToParentTag=her,this.addChild=fer}};function aer(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function ser(t,e,r,n,o,i,a){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));let s=this.options.tagValueProcessor(e,t,r,o,i);return s==null?t:typeof s!=typeof t||s!==t?s:this.options.trimValues?xhe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?xhe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function uer(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var ler=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function cer(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=IXe.getAllMatches(t,ler),o=n.length,i={};for(let a=0;a<o;a++){let s=this.resolveNameSpace(n[a][1]),u=n[a][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let c=this.options.attributeValueProcessor(s,u,e);c==null?i[l]=u:typeof c!=typeof u||c!==u?i[l]=c:i[l]=xhe(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 der=function(t){t=t.replace(/\r\n?/g,`
`);let e=new v2("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=jR(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,s).trim();if(this.options.removeNSPrefix){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let c=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),n="",i=s}else if(t[i+1]==="?"){let s=She(t,i,!1,"?>");if(!s)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,o),!(this.options.ignoreDeclaration&&s.tagName==="?xml"||this.options.ignorePiTags)){let u=new v2(s.tagName);u.add(this.options.textNodeName,""),s.tagName!==s.tagExp&&s.attrExpPresent&&(u[":@"]=this.buildAttributesMap(s.tagExp,o,s.tagName)),this.addChild(r,u,o)}i=s.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let s=jR(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,s-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=s}else if(t.substr(i+1,2)==="!D"){let s=oer(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=jR(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,s);n=this.saveTextToParentTag(n,r,o);let l=this.parseTextData(u,r.tagname,o,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=s+2}else{let s=She(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let h="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let v=this.readStopNodeData(t,l,f+1);if(!v)throw new Error(`Unexpected end of ${l}`);i=v.i,h=v.tagContent}let m=new v2(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 v2(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 v2(u);this.tagsNodeStack.push(r),u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),r=h}n="",i=f}}else n+=t[i];return e.child};function fer(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var per=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function her(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function mer(t,e,r){let n="*."+r;for(let o in t){let i=t[o];if(n===i||e===i)return!0}return!1}function ger(t,e,r=">"){let n,o="";for(let i=e;i<t.length;i++){let a=t[i];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===r[0])if(r[1]){if(t[i+1]===r[1])return{data:o,index:i}}else return{data:o,index:i};else a===" "&&(a=" ");o+=a}}function jR(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function She(t,e,r,n=">"){let o=ger(t,e+1,n);if(!o)return;let i=o.data,a=o.index,s=i.search(/\s/),u=i,l=!0;s!==-1&&(u=i.substring(0,s),i=i.substring(s+1).trimStart());let c=u;if(r){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),l=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:a,attrExpPresent:l,rawTagName:c}}function yer(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=jR(t,">",r,`${e} is not closed`);if(t.substring(r+2,i).trim()===e&&(o--,o===0))return{tagContent:t.substring(n,r),i};r=i}else if(t[r+1]==="?")r=jR(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=jR(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=jR(t,"]]>",r,"StopNode is not closed.")-2;else{let i=She(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function xhe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:ier(t,r)}else return IXe.isExist(t)?t:""}DXe.exports=whe});var FXe=b(LXe=>{"use strict";function ber(t,e){return NXe(t,e)}function NXe(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=_er(a),u="";if(r===void 0?u=s:u=r+"."+s,s===e.textNodeName)n===void 0?n=a[s]:n+=""+a[s];else{if(s===void 0)continue;if(a[s]){let l=NXe(a[s],e,u),c=wer(l,e);a[":@"]?ver(l,a[":@"],u,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[s]!==void 0&&o.hasOwnProperty(s)?(Array.isArray(o[s])||(o[s]=[o[s]]),o[s].push(l)):e.isArray(s,u,c)?o[s]=[l]:o[s]=l}}}return typeof n=="string"?n.length>0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function _er(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function ver(t,e,r,n){if(e){let o=Object.keys(e),i=o.length;for(let a=0;a<i;a++){let s=o[a];n.isArray(s,r+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function wer(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}LXe.prettify=ber});var BXe=b((q6n,kXe)=>{var{buildOptions:Ser}=OXe(),xer=jXe(),{prettify:Cer}=FXe(),Oer=bhe(),Che=class{constructor(e){this.externalEntities={},this.options=Ser(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=Oer.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new xer(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:Cer(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};kXe.exports=Che});var HXe=b((U6n,zXe)=>{var Eer=`
`;function Per(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=Eer),qXe(t,e,"",r)}function qXe(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=Ter(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let h=s[u];Mer(l,e)||(h=e.tagValueProcessor(u,h),h=UXe(h,e)),i&&(o+=n),o+=h,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let h=$Xe(s[":@"],e),m=u==="?xml"?"":n,v=s[u][0][e.textNodeName];v=v.length!==0?" "+v:"",o+=m+`<${u}${v}${h}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=$Xe(s[":@"],e),f=n+`<${u}${d}`,p=qXe(s[u],e,l,c);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!p||p.length===0)&&e.suppressEmptyNode?o+=f+"/>":p&&p.endsWith(">")?o+=f+`>${p}${n}</${u}>`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("</"))?o+=n+e.indentBy+p+n:o+=p,o+=`</${u}>`),i=!0}return o}function Ter(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(t.hasOwnProperty(n)&&n!==":@")return n}}function $Xe(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!t.hasOwnProperty(n))continue;let o=e.attributeValueProcessor(n,t[n]);o=UXe(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function Mer(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function UXe(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}zXe.exports=Per});var WXe=b((z6n,VXe)=>{"use strict";var Aer=HXe(),Rer={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function aP(t){this.options=Object.assign({},Rer,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=jer),this.processTextOrObjNode=Ier,this.options.format?(this.indentate=Der,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}aP.prototype.build=function(t){return this.options.preserveOrder?Aer(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};aP.prototype.j2x=function(t,e){let r="",n="";for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(typeof t[o]>"u")this.isAttribute(o)&&(n+="");else if(t[o]===null)this.isAttribute(o)?n+="":o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(t[o]instanceof Date)n+=this.buildTextValNode(t[o],o,"",e);else if(typeof t[o]!="object"){let i=this.isAttribute(o);if(i)r+=this.buildAttrPairStr(i,""+t[o]);else if(o===this.options.textNodeName){let a=this.options.tagValueProcessor(o,""+t[o]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(t[o],o,"",e)}else if(Array.isArray(t[o])){let i=t[o].length,a="",s="";for(let u=0;u<i;u++){let l=t[o][u];if(!(typeof l>"u"))if(l===null)o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let c=this.j2x(l,e+1);a+=c.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(s+=c.attrStr)}else a+=this.processTextOrObjNode(l,o,e);else if(this.options.oneListGroup){let c=this.options.tagValueProcessor(o,l);c=this.replaceEntitiesValue(c),a+=c}else a+=this.buildTextValNode(l,o,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,e)),n+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let i=Object.keys(t[o]),a=i.length;for(let s=0;s<a;s++)r+=this.buildAttrPairStr(i[s],""+t[o][i[s]])}else n+=this.processTextOrObjNode(t[o],o,e);return{attrStr:r,val:n}};aP.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Ier(t,e,r){let n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}aP.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",o=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};aP.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};aP.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}};aP.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function Der(t){return this.options.indentBy.repeat(t)}function jer(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}VXe.exports=aP});var GXe=b((H6n,JXe)=>{"use strict";var Ner=bhe(),Ler=BXe(),Fer=WXe();JXe.exports={XMLParser:Ler,XMLValidator:Ner,XMLBuilder:Fer}});var KXe,cb,YXe,XXe=C(()=>{Dt();KXe=B(GXe());ghe();cb=(t,e)=>BG(t,e).then(r=>{if(r.length){let n=new KXe.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]),Hpe(s)}return{}}),YXe=async(t,e)=>{let r=await cb(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var ZXe=C(()=>{fXe();pXe();gXe();XXe()});var NR=C(()=>{pYe();dXe();ZXe()});function ker(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function qG(t){return{schemeId:"smithy.api#noAuth"}}var QXe,eZe,tZe,Ohe=C(()=>{NR();mg();QXe=async(t,e,r)=>({operation:ib(e).operation,region:await Zc(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});eZe=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(qG(t));break}case"GetId":{e.push(qG(t));break}case"GetOpenIdToken":{e.push(qG(t));break}case"UnlinkIdentity":{e.push(qG(t));break}default:e.push(ker(t))}return e},tZe=t=>({...kG(t)})});var rZe,Zt,xi=C(()=>{rZe=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Zt={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var oZe,nZe=C(()=>{oZe={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 Ehe,Phe,iZe,aZe=C(()=>{Ehe={name:"SHA-256"},Phe={name:"HMAC",hash:Ehe},iZe=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 tL(){return typeof window<"u"?window:typeof self<"u"?self:$er}var $er,The=C(()=>{$er={}});var rL,Mhe,Ahe=C(()=>{rL=B(TJ());aZe();The();Mhe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,rL.isEmptyData)(e)){var r=(0,rL.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(r){return tL().crypto.subtle.sign(Phe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,rL.isEmptyData)(this.toHash)?Promise.resolve(iZe):Promise.resolve().then(function(){return tL().crypto.subtle.digest(Ehe,e.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){tL().crypto.subtle.importKey("raw",(0,rL.convertToBuffer)(e.secret),Phe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function sZe(t){if(Uer(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return zer(e)}return!1}function Uer(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function zer(t){return t&&qer.every(function(e){return typeof t[e]=="function"})}var qer,uZe=C(()=>{qer=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var lZe=C(()=>{uZe()});var cZe,dZe,UG,fZe=C(()=>{Ahe();cZe=B(Dfe());lZe();The();dZe=B(TJ()),UG=function(){function t(e){sZe(tL())?this.hash=new Mhe(e):this.hash=new cZe.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,dZe.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var Rhe=C(()=>{fZe();Ahe()});var Dhe=b((w2,Ihe)=>{(function(t,e){typeof w2=="object"&&typeof Ihe=="object"?Ihe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof w2=="object"?w2.bowser=e():t.bowser=e()})(w2,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(h){var m=d-i.getVersionPrecision(h),v=h+new Array(m+1).join(".0");return i.map(v.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var h=d[s];typeof h=="object"&&h!==null&&Object.keys(h).forEach(function(m){l[m]=h[m]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,h={},m=0,v={},g=0;if(Object.keys(f).forEach(function(R){var N=f[R];typeof N=="string"?(v[R]=N,g+=1):typeof N=="object"&&(h[R]=N,m+=1)}),m>0){var _=Object.keys(h),S=s.default.find(_,function(R){return p.isOS(R)});if(S){var x=this.satisfies(h[S]);if(x!==void 0)return x}var O=s.default.find(_,function(R){return p.isPlatform(R)});if(O){var T=this.satisfies(h[O]);if(T!==void 0)return T}}if(g>0){var E=Object.keys(v),M=s.default.find(E,function(R){return p.isBrowser(R,!0)});if(M!==void 0)return this.compareVersion(v[M])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var h=this.getBrowserName().toLowerCase(),m=f.toLowerCase(),v=s.default.getBrowserTypeByAlias(m);return p&&v&&(m=v.toLowerCase()),m===h},d.compareVersion=function(f){var p=[0],h=f,m=!1,v=this.getBrowserVersion();if(typeof v=="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(v,h,m))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(h){return p.is(h)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var pZe,zG,jhe=C(()=>{pZe=B(Dhe()),zG=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?pZe.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${r?.os?.name||"other"}`,r?.os?.version],["lang/js"],["md/browser",`${r?.browser?.name??"unknown"}_${r?.browser?.version??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n}});var hZe=C(()=>{});var HG,mZe=C(()=>{HG=t=>()=>Promise.reject(t)});var Nhe=C(()=>{hZe();mZe()});var gZe,VG,yZe=C(()=>{gZe=typeof TextEncoder=="function"?new TextEncoder:null,VG=t=>{if(typeof t=="string"){if(gZe)return gZe.encode(t).byteLength;let e=t.length;for(let r=e-1;r>=0;r--){let n=t.charCodeAt(r);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&r--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error(`Body Length computation failed for ${t}`)}});var Lhe=C(()=>{yZe()});var Fhe,khe=C(()=>{Fhe=t=>new TextEncoder().encode(t)});var bZe=C(()=>{khe()});var _Ze,vZe=C(()=>{_Ze=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var wZe=C(()=>{khe();bZe();vZe()});var RZe,fb,pb,oL,SZe,x2,nL,S2,Nx,Bhe,xZe,CZe,OZe,IZe,DZe,db,EZe,PZe,TZe,MZe,AZe,Her,jZe,NZe=C(()=>{RZe="required",fb="fn",pb="argv",oL="ref",SZe="isSet",x2="booleanEquals",nL="error",S2="endpoint",Nx="tree",Bhe="PartitionResult",xZe={[RZe]:!1,type:"String"},CZe={[RZe]:!0,default:!1,type:"Boolean"},OZe={[oL]:"Endpoint"},IZe={[fb]:x2,[pb]:[{[oL]:"UseFIPS"},!0]},DZe={[fb]:x2,[pb]:[{[oL]:"UseDualStack"},!0]},db={},EZe={[fb]:"getAttr",[pb]:[{[oL]:Bhe},"supportsFIPS"]},PZe={[fb]:x2,[pb]:[!0,{[fb]:"getAttr",[pb]:[{[oL]:Bhe},"supportsDualStack"]}]},TZe=[IZe],MZe=[DZe],AZe=[{[oL]:"Region"}],Her={version:"1.0",parameters:{Region:xZe,UseDualStack:CZe,UseFIPS:CZe,Endpoint:xZe},rules:[{conditions:[{[fb]:SZe,[pb]:[OZe]}],rules:[{conditions:TZe,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:nL},{conditions:MZe,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:nL},{endpoint:{url:OZe,properties:db,headers:db},type:S2}],type:Nx},{conditions:[{[fb]:SZe,[pb]:AZe}],rules:[{conditions:[{[fb]:"aws.partition",[pb]:AZe,assign:Bhe}],rules:[{conditions:[IZe,DZe],rules:[{conditions:[{[fb]:x2,[pb]:[!0,EZe]},PZe],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:db,headers:db},type:S2}],type:Nx},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:nL}],type:Nx},{conditions:TZe,rules:[{conditions:[{[fb]:x2,[pb]:[EZe,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:db,headers:db},type:S2}],type:Nx},{error:"FIPS is enabled but this partition does not support FIPS",type:nL}],type:Nx},{conditions:MZe,rules:[{conditions:[PZe],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:db,headers:db},type:S2}],type:Nx},{error:"DualStack is enabled but this partition does not support DualStack",type:nL}],type:Nx},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:db,headers:db},type:S2}],type:Nx}],type:Nx},{error:"Invalid Configuration: Missing Region",type:nL}]},jZe=Her});var LZe,FZe=C(()=>{HJ();KE();NZe();LZe=(t,e={})=>Yz(jZe,{endpointParams:t,logger:e.logger});Ax.aws=Xz});var kZe,BZe=C(()=>{NR();oP();Dt();eG();KN();wZe();Ohe();FZe();kZe=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??eP,base64Encoder:t?.base64Encoder??tP,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??LZe,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??eZe,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new IR},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new QN}],logger:t?.logger??new XE,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??YE,utf8Decoder:t?.utf8Decoder??Fhe,utf8Encoder:t?.utf8Encoder??_Ze})});var $Ze,qZe=C(()=>{$Ze=["in-region","cross-region","mobile","standard","legacy"]});var UZe,WG,Ver,zZe=C(()=>{Mx();UZe=B(Dhe());qZe();WG=({defaultsMode:t}={})=>D5e(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(Ver()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${$Ze.join(", ")}, got ${e}`)}}),Ver=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?UZe.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var $he=C(()=>{zZe()});var HZe,VZe=C(()=>{nZe();Rhe();jhe();Zz();a2();Nhe();Lhe();ub();BZe();Dt();$he();HZe=t=>{let e=WG(t),r=()=>e().then(wG),n=kZe(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??VG,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??zG({serviceId:n.serviceId,clientVersion:oZe.version}),maxAttempts:t?.maxAttempts??sb,region:t?.region??HG("Region is missing"),requestHandler:lb.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||t2),sha256:t?.sha256??UG,streamCollector:t?.streamCollector??YN,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(KJ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(YJ))}}});var JG,GG,WZe=C(()=>{JG=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");let r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},GG=t=>({region:t.region()})});var JZe=C(()=>{});var qhe=C(()=>{});var GZe=C(()=>{qhe()});var KZe=C(()=>{GZe();qhe()});var YZe=C(()=>{JZe();KZe()});var Uhe=C(()=>{WZe();YZe()});var XZe,ZZe,QZe=C(()=>{XZe=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},ZZe=t=>({httpHandler:t.httpHandler()})});var eQe=C(()=>{QZe()});var tQe=C(()=>{vs()});var rQe=C(()=>{});var nQe=C(()=>{});function Jer(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var LR,oQe=C(()=>{LR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new LR({...e,headers:{...e.headers}});return r.query&&(r.query=Jer(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return LR.clone(this)}}});var iQe=C(()=>{});var aQe=C(()=>{});var sQe=C(()=>{});var zhe=C(()=>{eQe();tQe();rQe();nQe();oQe();iQe();aQe();sQe()});var uQe,lQe,cQe=C(()=>{uQe=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},lQe=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var KG,dQe,fQe=C(()=>{Uhe();zhe();Dt();cQe();KG=t=>t,dQe=(t,e)=>{let r={...KG(JG(t)),...KG(SG(t)),...KG(XZe(t)),...KG(uQe(t))};return e.forEach(n=>n.configure(r)),{...t,...GG(r),...xG(r),...ZZe(r),...lQe(r)}}});var sP,YG=C(()=>{Ffe();kfe();Bfe();rpe();Zz();oP();Kpe();bn();EG();Dt();Ohe();xi();VZe();fQe();sP=class extends ER{constructor(...[e]){let r=HZe(e||{}),n=rZe(r),o=LJ(n),i=hG(o),a=ZJ(i),s=a,u=nG(s),l=tZe(u),c=dQe(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(JJ(this.config)),this.middlewareStack.use(OG(this.config)),this.middlewareStack.use(TG(this.config)),this.middlewareStack.use(DJ(this.config)),this.middlewareStack.use(jJ(this.config)),this.middlewareStack.use(NJ(this.config)),this.middlewareStack.use(oG(this.config,{httpAuthSchemeParametersProvider:QXe,identityProviderConfigProvider:async d=>new ZN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(PG(this.config))}destroy(){super.destroy()}}});var Ol,Hhe=C(()=>{Dt();Ol=class extends nP{constructor(e){super(e),Object.setPrototypeOf(this,Ol.prototype)}}});var iL,aL,sL,uL,lL,cL,dL,fL,pL,hL,mL,Vhe=C(()=>{Hhe();iL=class extends Ol{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,iL.prototype)}},aL=class extends Ol{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,aL.prototype)}},sL=class extends Ol{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,sL.prototype)}},uL=class extends Ol{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,uL.prototype)}},lL=class extends Ol{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,lL.prototype)}},cL=class extends Ol{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,cL.prototype)}},dL=class extends Ol{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,dL.prototype)}},fL=class extends Ol{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,fL.prototype)}},pL=class extends Ol{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,pL.prototype)}},hL=class extends Ol{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,hL.prototype)}},mL=class extends Ol{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,mL.prototype)}}});function pa(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var pQe,hQe,mQe,gQe,yQe,bQe,_Qe,vQe,wQe,SQe,xQe,CQe,OQe,EQe,PQe,TQe,MQe,AQe,RQe,IQe,DQe,jQe,NQe,LQe,FQe,kQe,BQe,$Qe,qQe,UQe,zQe,HQe,VQe,WQe,JQe,GQe,KQe,YQe,XQe,ZQe,QQe,eet,tet,ret,net,oet,da,Ker,Yer,Xer,Zer,Qer,etr,ttr,rtr,ntr,otr,itr,atr,str,utr,iet,ltr,En,ctr,fa,zi=C(()=>{NR();zhe();Dt();Hhe();Vhe();pQe=async(t,e)=>{let r=pa("CreateIdentityPool"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},hQe=async(t,e)=>{let r=pa("DeleteIdentities"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},mQe=async(t,e)=>{let r=pa("DeleteIdentityPool"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},gQe=async(t,e)=>{let r=pa("DescribeIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},yQe=async(t,e)=>{let r=pa("DescribeIdentityPool"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},bQe=async(t,e)=>{let r=pa("GetCredentialsForIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},_Qe=async(t,e)=>{let r=pa("GetId"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},vQe=async(t,e)=>{let r=pa("GetIdentityPoolRoles"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},wQe=async(t,e)=>{let r=pa("GetOpenIdToken"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},SQe=async(t,e)=>{let r=pa("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},xQe=async(t,e)=>{let r=pa("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},CQe=async(t,e)=>{let r=pa("ListIdentities"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},OQe=async(t,e)=>{let r=pa("ListIdentityPools"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},EQe=async(t,e)=>{let r=pa("ListTagsForResource"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},PQe=async(t,e)=>{let r=pa("LookupDeveloperIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},TQe=async(t,e)=>{let r=pa("MergeDeveloperIdentities"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},MQe=async(t,e)=>{let r=pa("SetIdentityPoolRoles"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},AQe=async(t,e)=>{let r=pa("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},RQe=async(t,e)=>{let r=pa("TagResource"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},IQe=async(t,e)=>{let r=pa("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},DQe=async(t,e)=>{let r=pa("UnlinkIdentity"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},jQe=async(t,e)=>{let r=pa("UntagResource"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},NQe=async(t,e)=>{let r=pa("UpdateIdentityPool"),n;return n=JSON.stringify(It(t)),fa(e,r,"/",void 0,n)},LQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},FQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},kQe=async(t,e)=>t.statusCode>=300?da(t,e):(await rP(t.body,e),{$metadata:En(t)}),BQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=iet(r,e),{$metadata:En(t),...n}},$Qe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},qQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=str(r,e),{$metadata:En(t),...n}},UQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},zQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},HQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},VQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},WQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},JQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=ltr(r,e),{$metadata:En(t),...n}},GQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},KQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},YQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},XQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},ZQe=async(t,e)=>t.statusCode>=300?da(t,e):(await rP(t.body,e),{$metadata:En(t)}),QQe=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},eet=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},tet=async(t,e)=>t.statusCode>=300?da(t,e):(await rP(t.body,e),{$metadata:En(t)}),ret=async(t,e)=>t.statusCode>=300?da(t,e):(await rP(t.body,e),{$metadata:En(t)}),net=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},oet=async(t,e)=>{if(t.statusCode>=300)return da(t,e);let r=await os(t.body,e),n={};return n=It(r),{$metadata:En(t),...n}},da=async(t,e)=>{let r={...t,body:await hXe(t.body,e)},n=mXe(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await Zer(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await etr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await ttr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await rtr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await ntr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await itr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await otr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Xer(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await Qer(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await Yer(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await Ker(r,e);default:let o=r.body;return ctr({output:t,parsedBody:o,errorCode:n})}},Ker=async(t,e)=>{let r=t.body,n=It(r),o=new mL({$metadata:En(t),...n});return ca(o,r)},Yer=async(t,e)=>{let r=t.body,n=It(r),o=new hL({$metadata:En(t),...n});return ca(o,r)},Xer=async(t,e)=>{let r=t.body,n=It(r),o=new fL({$metadata:En(t),...n});return ca(o,r)},Zer=async(t,e)=>{let r=t.body,n=It(r),o=new iL({$metadata:En(t),...n});return ca(o,r)},Qer=async(t,e)=>{let r=t.body,n=It(r),o=new pL({$metadata:En(t),...n});return ca(o,r)},etr=async(t,e)=>{let r=t.body,n=It(r),o=new aL({$metadata:En(t),...n});return ca(o,r)},ttr=async(t,e)=>{let r=t.body,n=It(r),o=new sL({$metadata:En(t),...n});return ca(o,r)},rtr=async(t,e)=>{let r=t.body,n=It(r),o=new uL({$metadata:En(t),...n});return ca(o,r)},ntr=async(t,e)=>{let r=t.body,n=It(r),o=new lL({$metadata:En(t),...n});return ca(o,r)},otr=async(t,e)=>{let r=t.body,n=It(r),o=new dL({$metadata:En(t),...n});return ca(o,r)},itr=async(t,e)=>{let r=t.body,n=It(r),o=new cL({$metadata:En(t),...n});return ca(o,r)},atr=(t,e)=>l2(t,{AccessKeyId:Nr,Expiration:r=>XN(_G(MR(r))),SecretKey:Nr,SessionToken:Nr}),str=(t,e)=>l2(t,{Credentials:r=>atr(r,e),IdentityId:Nr}),utr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>iet(n,e)),iet=(t,e)=>l2(t,{CreationDate:r=>XN(_G(MR(r))),IdentityId:Nr,LastModifiedDate:r=>XN(_G(MR(r))),Logins:It}),ltr=(t,e)=>l2(t,{Identities:r=>utr(r,e),IdentityPoolId:Nr,NextToken:Nr}),En=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),ctr=vG(Ol),fa=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new LR(l)}});var XG,Whe=C(()=>{bn();On();Dt();xi();zi();XG=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(pQe).de(LQe).build(){}});var ZG,Jhe=C(()=>{bn();On();Dt();xi();zi();ZG=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(hQe).de(FQe).build(){}});var QG,Ghe=C(()=>{bn();On();Dt();xi();zi();QG=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(mQe).de(kQe).build(){}});var eK,Khe=C(()=>{bn();On();Dt();xi();zi();eK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(gQe).de(BQe).build(){}});var tK,Yhe=C(()=>{bn();On();Dt();xi();zi();tK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(yQe).de($Qe).build(){}});var gL,Xhe=C(()=>{bn();On();Dt();xi();zi();gL=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(bQe).de(qQe).build(){}});var yL,Zhe=C(()=>{bn();On();Dt();xi();zi();yL=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(_Qe).de(UQe).build(){}});var rK,Qhe=C(()=>{bn();On();Dt();xi();zi();rK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(vQe).de(zQe).build(){}});var nK,eme=C(()=>{bn();On();Dt();xi();zi();nK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(wQe).de(HQe).build(){}});var oK,tme=C(()=>{bn();On();Dt();xi();zi();oK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(SQe).de(VQe).build(){}});var iK,rme=C(()=>{bn();On();Dt();xi();zi();iK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(xQe).de(WQe).build(){}});var aK,nme=C(()=>{bn();On();Dt();xi();zi();aK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(CQe).de(JQe).build(){}});var bL,sK=C(()=>{bn();On();Dt();xi();zi();bL=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(OQe).de(GQe).build(){}});var uK,ome=C(()=>{bn();On();Dt();xi();zi();uK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(EQe).de(KQe).build(){}});var lK,ime=C(()=>{bn();On();Dt();xi();zi();lK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(PQe).de(YQe).build(){}});var cK,ame=C(()=>{bn();On();Dt();xi();zi();cK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(TQe).de(XQe).build(){}});var dK,sme=C(()=>{bn();On();Dt();xi();zi();dK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(MQe).de(ZQe).build(){}});var fK,ume=C(()=>{bn();On();Dt();xi();zi();fK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(AQe).de(QQe).build(){}});var pK,lme=C(()=>{bn();On();Dt();xi();zi();pK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(RQe).de(eet).build(){}});var hK,cme=C(()=>{bn();On();Dt();xi();zi();hK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(IQe).de(tet).build(){}});var mK,dme=C(()=>{bn();On();Dt();xi();zi();mK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(DQe).de(ret).build(){}});var gK,fme=C(()=>{bn();On();Dt();xi();zi();gK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(jQe).de(net).build(){}});var yK,pme=C(()=>{bn();On();Dt();xi();zi();yK=class extends it.classBuilder().ep({...Zt}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(NQe).de(oet).build(){}});var dtr,hme,aet=C(()=>{Dt();YG();Whe();Jhe();Ghe();Khe();Yhe();Xhe();Zhe();Qhe();eme();tme();rme();nme();sK();ome();ime();ame();sme();ume();lme();cme();dme();fme();pme();dtr={CreateIdentityPoolCommand:XG,DeleteIdentitiesCommand:ZG,DeleteIdentityPoolCommand:QG,DescribeIdentityCommand:eK,DescribeIdentityPoolCommand:tK,GetCredentialsForIdentityCommand:gL,GetIdCommand:yL,GetIdentityPoolRolesCommand:rK,GetOpenIdTokenCommand:nK,GetOpenIdTokenForDeveloperIdentityCommand:oK,GetPrincipalTagAttributeMapCommand:iK,ListIdentitiesCommand:aK,ListIdentityPoolsCommand:bL,ListTagsForResourceCommand:uK,LookupDeveloperIdentityCommand:lK,MergeDeveloperIdentitiesCommand:cK,SetIdentityPoolRolesCommand:dK,SetPrincipalTagAttributeMapCommand:fK,TagResourceCommand:pK,UnlinkDeveloperIdentityCommand:hK,UnlinkIdentityCommand:mK,UntagResourceCommand:gK,UpdateIdentityPoolCommand:yK},hme=class extends sP{};bG(dtr,hme)});var set=C(()=>{Whe();Jhe();Ghe();Khe();Yhe();Xhe();Zhe();Qhe();eme();tme();rme();nme();sK();ome();ime();ame();sme();ume();lme();cme();dme();fme();pme()});var uet=C(()=>{});var nKn,cet=C(()=>{oP();YG();sK();nKn=Gpe(sP,bL,"NextToken","NextToken","MaxResults")});var det=C(()=>{uet();cet()});var fet=C(()=>{Vhe()});var pet=C(()=>{YG();aet();set();det();fet()});var mme={};nf(mme,{CognitoIdentityClient:()=>sP,GetCredentialsForIdentityCommand:()=>gL,GetIdCommand:()=>yL});var gme=C(()=>{pet()});function bK(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(gme(),mme)),{Credentials:{AccessKeyId:n=ftr(t.logger),Expiration:o,SecretKey:i=htr(t.logger),SessionToken:a}=ptr(t.logger)}=await(t.client??new r(Object.assign({},t.clientConfig??{},{region:t.clientConfig?.region??t.parentClientConfig?.region}))).send(new e({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await IJ(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function ftr(t){throw new ns("Response from Amazon Cognito contained no access key ID",{logger:t})}function ptr(t){throw new ns("Response from Amazon Cognito contained no credentials",{logger:t})}function htr(t){throw new ns("Response from Amazon Cognito contained no secret key",{logger:t})}var yme=C(()=>{Mx();jfe()});var bme,_K,het=C(()=>{bme="IdentityIds",_K=class{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",r=>{let n=r.get(e);return new Promise(o=>{n.onerror=()=>o(null),n.onsuccess=()=>o(n.result?n.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",r=>{let n=r.delete(e);return new Promise((o,i)=>{n.onerror=()=>i(n.error),n.onsuccess=()=>o()})})}setItem(e,r){return this.withObjectStore("readwrite",n=>{let o=n.put({id:e,value:r});return new Promise((i,a)=>{o.onerror=()=>a(o.error),o.onsuccess=()=>i()})})}getDb(){let e=self.indexedDB.open(this.dbName,1);return new Promise((r,n)=>{e.onsuccess=()=>{r(e.result)},e.onerror=()=>{n(e.error)},e.onblocked=()=>{n(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{let o=e.result;o.onerror=()=>{n(new Error("Failed to create object store"))},o.createObjectStore(bme,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(bme,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(bme)))}).catch(i=>{throw n.close(),i})})}}});var vK,met=C(()=>{vK=class{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,r){this.store[e]=r}}});function get(){return typeof self=="object"&&self.indexedDB?new _K:typeof window=="object"&&window.localStorage?window.localStorage:mtr}var mtr,yet=C(()=>{het();met();mtr=new vK});function bet({accountId:t,cache:e=get(),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(()=>(gme(),mme)),h=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),m=c&&await e.getItem(c);if(!m){let{IdentityId:v=gtr(u)}=await h.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await IJ(a):void 0}));m=v,c&&Promise.resolve(e.setItem(c,m)).catch(()=>{})}return d=bK({client:h,customRoleArn:o,logins:a,identityId:m}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function gtr(t){throw new ns("Response from Amazon Cognito contained no identity ID",{logger:t})}var _et=C(()=>{Mx();yme();yet();jfe()});var _me=C(()=>{E5e();P5e();T5e();yme();_et()});var ytr,vet=C(()=>{_me();ytr=t=>bK({...t})});var btr,wet=C(()=>{_me();btr=t=>bet({...t})});var _tr,vtr,wtr,xet,Cet=C(()=>{Mx();_tr="169.254.170.2",vtr="169.254.170.23",wtr="[fd00:ec2::23]",xet=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===_tr||t.hostname===vtr||t.hostname===wtr)){if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(t.hostname==="localhost")return;let r=t.hostname.split("."),n=o=>{let i=parseInt(o,10);return 0<=i&&i<=255};if(r[0]==="127"&&n(r[1])&&n(r[2])&&n(r[3])&&r.length===4)return}throw new ns(`URL not accepted. It must either be HTTPS or match one of the following:
- loopback CIDR 127.0.0.0/8 or [::1/128]
- ECS container host 169.254.170.2
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:e})}}});var Oet=C(()=>{});var Eet=C(()=>{Oet()});var Pet=C(()=>{vs()});var Tet=C(()=>{});var Met=C(()=>{});function Str(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var FR,Aet=C(()=>{FR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new FR({...e,headers:{...e.headers}});return r.query&&(r.query=Str(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return FR.clone(this)}}});var Ret=C(()=>{});var Iet=C(()=>{});var Det=C(()=>{});var jet=C(()=>{Eet();Pet();Tet();Met();Aet();Ret();Iet();Det()});function Net(t){return new FR({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((e,[r,n])=>(e[r]=n,e),{}),fragment:t.hash})}async function Let(t,e){let n=await XKe(t.body).transformToString();if(t.statusCode===200){let o=JSON.parse(n);if(typeof o.AccessKeyId!="string"||typeof o.SecretAccessKey!="string"||typeof o.Token!="string"||typeof o.Expiration!="string")throw new ns("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:e});return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.Token,expiration:h7e(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new ns(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new ns(`Server responded with status: ${t.statusCode}`,{logger:e})}var Fet=C(()=>{Mx();jet();Dt();Lpe()});var ket,Bet=C(()=>{ket=(t,e,r)=>async()=>{for(let n=0;n<e;++n)try{return await t()}catch{await new Promise(i=>setTimeout(i,r))}return await t()}});var vme,$et=C(()=>{a2();Mx();Cet();Fet();Bet();vme=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new ns("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);xet(n,t.logger);let o=new lb;return ket(async()=>{let i=Net(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return Let(a.response)},t.maxRetries??3,t.timeout??1e3)}});var qet=C(()=>{$et()});function xtr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Uet(t){return{schemeId:"smithy.api#noAuth"}}var zet,Het,Ctr,Vet,wme=C(()=>{NR();mg();C2();zet=async(t,e,r)=>({operation:ib(e).operation,region:await Zc(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Het=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(Uet(t));break}case"AssumeRoleWithWebIdentity":{e.push(Uet(t));break}default:e.push(xtr(t))}return e},Ctr=t=>({...t,stsClientCtor:Rh}),Vet=t=>{let e=Ctr(t);return{...kG(e)}}});var Wet,Qc,hb=C(()=>{Wet=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Qc={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 Get,Jet=C(()=>{Get={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 Sme,xme=C(()=>{Sme=t=>new TextEncoder().encode(t)});var Ket=C(()=>{xme()});var Yet,Xet=C(()=>{Yet=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var Zet=C(()=>{xme();Ket();Xet()});var ltt,Mr,Un,zn,lP,uP,nc,ctt,dtt,ftt,Hi,Qet,mb,_L,Ome,ett,Cme,ptt,ttt,oc,rtt,htt,mtt,ed,wp,ntt,gtt,ytt,ott,btt,itt,att,stt,utt,Etr,_tt,vtt=C(()=>{ltt="required",Mr="type",Un="fn",zn="argv",lP="ref",uP="booleanEquals",nc="stringEquals",ctt="sigv4",dtt="sts",ftt="us-east-1",Hi="endpoint",Qet="https://sts.{Region}.{PartitionResult#dnsSuffix}",mb="tree",_L="error",Ome="getAttr",ett={[ltt]:!1,[Mr]:"String"},Cme={[ltt]:!0,default:!1,[Mr]:"Boolean"},ptt={[lP]:"Endpoint"},ttt={[Un]:"isSet",[zn]:[{[lP]:"Region"}]},oc={[lP]:"Region"},rtt={[Un]:"aws.partition",[zn]:[oc],assign:"PartitionResult"},htt={[lP]:"UseFIPS"},mtt={[lP]:"UseDualStack"},ed={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:ctt,signingName:dtt,signingRegion:ftt}]},headers:{}},wp={},ntt={conditions:[{[Un]:nc,[zn]:[oc,"aws-global"]}],[Hi]:ed,[Mr]:Hi},gtt={[Un]:uP,[zn]:[htt,!0]},ytt={[Un]:uP,[zn]:[mtt,!0]},ott={[Un]:Ome,[zn]:[{[lP]:"PartitionResult"},"supportsFIPS"]},btt={[lP]:"PartitionResult"},itt={[Un]:uP,[zn]:[!0,{[Un]:Ome,[zn]:[btt,"supportsDualStack"]}]},att=[{[Un]:"isSet",[zn]:[ptt]}],stt=[gtt],utt=[ytt],Etr={version:"1.0",parameters:{Region:ett,UseDualStack:Cme,UseFIPS:Cme,Endpoint:ett,UseGlobalEndpoint:Cme},rules:[{conditions:[{[Un]:uP,[zn]:[{[lP]:"UseGlobalEndpoint"},!0]},{[Un]:"not",[zn]:att},ttt,rtt,{[Un]:uP,[zn]:[htt,!1]},{[Un]:uP,[zn]:[mtt,!1]}],rules:[{conditions:[{[Un]:nc,[zn]:[oc,"ap-northeast-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"ap-south-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"ap-southeast-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"ap-southeast-2"]}],endpoint:ed,[Mr]:Hi},ntt,{conditions:[{[Un]:nc,[zn]:[oc,"ca-central-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"eu-central-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"eu-north-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"eu-west-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"eu-west-2"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"eu-west-3"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"sa-east-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,ftt]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"us-east-2"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"us-west-1"]}],endpoint:ed,[Mr]:Hi},{conditions:[{[Un]:nc,[zn]:[oc,"us-west-2"]}],endpoint:ed,[Mr]:Hi},{endpoint:{url:Qet,properties:{authSchemes:[{name:ctt,signingName:dtt,signingRegion:"{Region}"}]},headers:wp},[Mr]:Hi}],[Mr]:mb},{conditions:att,rules:[{conditions:stt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Mr]:_L},{conditions:utt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Mr]:_L},{endpoint:{url:ptt,properties:wp,headers:wp},[Mr]:Hi}],[Mr]:mb},{conditions:[ttt],rules:[{conditions:[rtt],rules:[{conditions:[gtt,ytt],rules:[{conditions:[{[Un]:uP,[zn]:[!0,ott]},itt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:wp,headers:wp},[Mr]:Hi}],[Mr]:mb},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Mr]:_L}],[Mr]:mb},{conditions:stt,rules:[{conditions:[{[Un]:uP,[zn]:[ott,!0]}],rules:[{conditions:[{[Un]:nc,[zn]:[{[Un]:Ome,[zn]:[btt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:wp,headers:wp},[Mr]:Hi},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:wp,headers:wp},[Mr]:Hi}],[Mr]:mb},{error:"FIPS is enabled but this partition does not support FIPS",[Mr]:_L}],[Mr]:mb},{conditions:utt,rules:[{conditions:[itt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:wp,headers:wp},[Mr]:Hi}],[Mr]:mb},{error:"DualStack is enabled but this partition does not support DualStack",[Mr]:_L}],[Mr]:mb},ntt,{endpoint:{url:Qet,properties:wp,headers:wp},[Mr]:Hi}],[Mr]:mb}],[Mr]:mb},{error:"Invalid Configuration: Missing Region",[Mr]:_L}]},_tt=Etr});var wtt,Stt=C(()=>{HJ();KE();vtt();wtt=(t,e={})=>Yz(_tt,{endpointParams:t,logger:e.logger});Ax.aws=Xz});var xtt,Ctt=C(()=>{NR();oP();Dt();eG();KN();Zet();wme();Stt();xtt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??eP,base64Encoder:t?.base64Encoder??tP,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??wtt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Het,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new IR},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new QN}],logger:t?.logger??new XE,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??YE,utf8Decoder:t?.utf8Decoder??Sme,utf8Encoder:t?.utf8Encoder??Yet})});var Ott,Ett=C(()=>{Jet();Rhe();jhe();Zz();a2();Nhe();Lhe();ub();Ctt();Dt();$he();Ott=t=>{let e=WG(t),r=()=>e().then(wG),n=xtt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??VG,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??zG({serviceId:n.serviceId,clientVersion:Get.version}),maxAttempts:t?.maxAttempts??sb,region:t?.region??HG("Region is missing"),requestHandler:lb.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||t2),sha256:t?.sha256??UG,streamCollector:t?.streamCollector??YN,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(KJ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(YJ))}}});var Ptt,Ttt,Mtt=C(()=>{Ptt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Ttt=t=>({httpHandler:t.httpHandler()})});var Att=C(()=>{Mtt()});var Rtt=C(()=>{vs()});var Itt=C(()=>{});var Dtt=C(()=>{});function Ptr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var kR,jtt=C(()=>{kR=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new kR({...e,headers:{...e.headers}});return r.query&&(r.query=Ptr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return kR.clone(this)}}});var Ntt=C(()=>{});var Ltt=C(()=>{});var Ftt=C(()=>{});var Eme=C(()=>{Att();Rtt();Itt();Dtt();jtt();Ntt();Ltt();Ftt()});var ktt,Btt,$tt=C(()=>{ktt=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},Btt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var wK,qtt,Utt=C(()=>{Uhe();Eme();Dt();$tt();wK=t=>t,qtt=(t,e)=>{let r={...wK(JG(t)),...wK(SG(t)),...wK(Ptt(t)),...wK(ktt(t))};return e.forEach(n=>n.configure(r)),{...t,...GG(r),...xG(r),...Ttt(r),...Btt(r)}}});var Rh,C2=C(()=>{Ffe();kfe();Bfe();rpe();Zz();oP();Kpe();bn();EG();Dt();wme();hb();Ett();Utt();Rh=class extends ER{constructor(...[e]){let r=Ott(e||{}),n=Wet(r),o=LJ(n),i=hG(o),a=ZJ(i),s=a,u=nG(s),l=Vet(u),c=qtt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(JJ(this.config)),this.middlewareStack.use(OG(this.config)),this.middlewareStack.use(TG(this.config)),this.middlewareStack.use(DJ(this.config)),this.middlewareStack.use(jJ(this.config)),this.middlewareStack.use(NJ(this.config)),this.middlewareStack.use(oG(this.config,{httpAuthSchemeParametersProvider:zet,identityProviderConfigProvider:async d=>new ZN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(PG(this.config))}destroy(){super.destroy()}}});var ic,SK=C(()=>{Dt();ic=class extends nP{constructor(e){super(e),Object.setPrototypeOf(this,ic.prototype)}}});var BR,$R,qR,UR,zR,HR,VR,WR,vL,Pme,Tme,Mme,Ame,Rme,Ime,Dme,cP=C(()=>{Dt();SK();BR=class extends ic{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,BR.prototype)}},$R=class extends ic{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,$R.prototype)}},qR=class extends ic{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,qR.prototype)}},UR=class extends ic{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,UR.prototype)}},zR=class extends ic{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,zR.prototype)}},HR=class extends ic{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,HR.prototype)}},VR=class extends ic{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,VR.prototype)}},WR=class extends ic{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,WR.prototype)}},vL=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:yG}}),Pme=t=>({...t,...t.Credentials&&{Credentials:vL(t.Credentials)}}),Tme=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:yG}}),Mme=t=>({...t,...t.Credentials&&{Credentials:vL(t.Credentials)}}),Ame=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:yG}}),Rme=t=>({...t,...t.Credentials&&{Credentials:vL(t.Credentials)}}),Ime=t=>({...t,...t.Credentials&&{Credentials:vL(t.Credentials)}}),Dme=t=>({...t,...t.Credentials&&{Credentials:vL(t.Credentials)}})});var ztt,Htt,Vtt,Wtt,Jtt,Gtt,Ktt,Ytt,Xtt,Ztt,Qtt,ert,trt,rrt,nrt,ort,dP,Ttr,Mtr,Atr,Rtr,Itr,Dtr,jtr,Ntr,Ltr,Ftr,ktr,Btr,$tr,qtr,Utr,ztr,xK,Htr,Vtr,Wtr,Jtr,Gtr,irt,uge,Ktr,Ytr,Xtr,O2,Ztr,Qtr,err,trr,rrr,nrr,orr,irr,arr,srr,urr,lrr,crr,drr,td,frr,fP,pP,hP,mP,wL,prr,jme,Lx,hrr,mrr,SL,Fx,xL,Bd,Nme,grr,Lme,$d,Fme,kme,Bme,$me,qme,yrr,brr,_rr,vrr,Ume,zme,Hme,Vme,Ih,Dh,Wme,Jme,Gme,Kme,jh,Yme,kx,CL,Xme,Zme,Qme,ege,Nh,OL,tge,rge,EL,PL,nge,oge,gP,ige,age,sge,Vi,yP,wrr,Bx=C(()=>{NR();Eme();Dt();cP();SK();ztt=async(t,e)=>{let r=pP,n;return n=yP({...Ltr(t,e),[mP]:prr,[gP]:hP}),fP(e,r,"/",void 0,n)},Htt=async(t,e)=>{let r=pP,n;return n=yP({...Ftr(t,e),[mP]:hrr,[gP]:hP}),fP(e,r,"/",void 0,n)},Vtt=async(t,e)=>{let r=pP,n;return n=yP({...ktr(t,e),[mP]:mrr,[gP]:hP}),fP(e,r,"/",void 0,n)},Wtt=async(t,e)=>{let r=pP,n;return n=yP({...Btr(t,e),[mP]:grr,[gP]:hP}),fP(e,r,"/",void 0,n)},Jtt=async(t,e)=>{let r=pP,n;return n=yP({...$tr(t,e),[mP]:yrr,[gP]:hP}),fP(e,r,"/",void 0,n)},Gtt=async(t,e)=>{let r=pP,n;return n=yP({...qtr(t,e),[mP]:brr,[gP]:hP}),fP(e,r,"/",void 0,n)},Ktt=async(t,e)=>{let r=pP,n;return n=yP({...Utr(t,e),[mP]:_rr,[gP]:hP}),fP(e,r,"/",void 0,n)},Ytt=async(t,e)=>{let r=pP,n;return n=yP({...ztr(t,e),[mP]:vrr,[gP]:hP}),fP(e,r,"/",void 0,n)},Xtt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=Ktr(r.AssumeRoleResult,e),{$metadata:td(t),...n}},Ztt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=Ytr(r.AssumeRoleWithSAMLResult,e),{$metadata:td(t),...n}},Qtt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=Xtr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:td(t),...n}},ert=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=Ztr(r.DecodeAuthorizationMessageResult,e),{$metadata:td(t),...n}},trt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=trr(r.GetAccessKeyInfoResult,e),{$metadata:td(t),...n}},rrt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=rrr(r.GetCallerIdentityResult,e),{$metadata:td(t),...n}},nrt=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=nrr(r.GetFederationTokenResult,e),{$metadata:td(t),...n}},ort=async(t,e)=>{if(t.statusCode>=300)return dP(t,e);let r=await cb(t.body,e),n={};return n=orr(r.GetSessionTokenResult,e),{$metadata:td(t),...n}},dP=async(t,e)=>{let r={...t,body:await YXe(t.body,e)},n=wrr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await Ttr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await Dtr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await jtr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await Ntr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await Atr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await Itr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await Mtr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await Rtr(r,e);default:let o=r.body;return frr({output:t,parsedBody:o.Error,errorCode:n})}},Ttr=async(t,e)=>{let r=t.body,n=Qtr(r.Error,e),o=new BR({$metadata:td(t),...n});return ca(o,r)},Mtr=async(t,e)=>{let r=t.body,n=irr(r.Error,e),o=new VR({$metadata:td(t),...n});return ca(o,r)},Atr=async(t,e)=>{let r=t.body,n=arr(r.Error,e),o=new zR({$metadata:td(t),...n});return ca(o,r)},Rtr=async(t,e)=>{let r=t.body,n=srr(r.Error,e),o=new WR({$metadata:td(t),...n});return ca(o,r)},Itr=async(t,e)=>{let r=t.body,n=urr(r.Error,e),o=new HR({$metadata:td(t),...n});return ca(o,r)},Dtr=async(t,e)=>{let r=t.body,n=lrr(r.Error,e),o=new $R({$metadata:td(t),...n});return ca(o,r)},jtr=async(t,e)=>{let r=t.body,n=crr(r.Error,e),o=new qR({$metadata:td(t),...n});return ca(o,r)},Ntr=async(t,e)=>{let r=t.body,n=drr(r.Error,e),o=new UR({$metadata:td(t),...n});return ca(o,r)},Ltr=(t,e)=>{let r={};if(t[kx]!=null&&(r[kx]=t[kx]),t[CL]!=null&&(r[CL]=t[CL]),t[Dh]!=null){let n=xK(t[Dh],e);t[Dh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Ih]!=null&&(r[Ih]=t[Ih]),t[$d]!=null&&(r[$d]=t[$d]),t[EL]!=null){let n=irt(t[EL],e);t[EL]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[nge]!=null){let n=Gtr(t[nge],e);t[nge]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[kme]!=null&&(r[kme]=t[kme]),t[OL]!=null&&(r[OL]=t[OL]),t[PL]!=null&&(r[PL]=t[PL]),t[Nh]!=null&&(r[Nh]=t[Nh]),t[Gme]!=null){let n=Wtr(t[Gme],e);t[Gme]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},Ftr=(t,e)=>{let r={};if(t[kx]!=null&&(r[kx]=t[kx]),t[Wme]!=null&&(r[Wme]=t[Wme]),t[Qme]!=null&&(r[Qme]=t[Qme]),t[Dh]!=null){let n=xK(t[Dh],e);t[Dh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Ih]!=null&&(r[Ih]=t[Ih]),t[$d]!=null&&(r[$d]=t[$d]),r},ktr=(t,e)=>{let r={};if(t[kx]!=null&&(r[kx]=t[kx]),t[CL]!=null&&(r[CL]=t[CL]),t[age]!=null&&(r[age]=t[age]),t[Kme]!=null&&(r[Kme]=t[Kme]),t[Dh]!=null){let n=xK(t[Dh],e);t[Dh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Ih]!=null&&(r[Ih]=t[Ih]),t[$d]!=null&&(r[$d]=t[$d]),r},Btr=(t,e)=>{let r={};return t[Bme]!=null&&(r[Bme]=t[Bme]),r},$tr=(t,e)=>{let r={};return t[wL]!=null&&(r[wL]=t[wL]),r},qtr=(t,e)=>({}),Utr=(t,e)=>{let r={};if(t[Hme]!=null&&(r[Hme]=t[Hme]),t[Ih]!=null&&(r[Ih]=t[Ih]),t[Dh]!=null){let n=xK(t[Dh],e);t[Dh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[$d]!=null&&(r[$d]=t[$d]),t[EL]!=null){let n=irt(t[EL],e);t[EL]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},ztr=(t,e)=>{let r={};return t[$d]!=null&&(r[$d]=t[$d]),t[OL]!=null&&(r[OL]=t[OL]),t[PL]!=null&&(r[PL]=t[PL]),r},xK=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Htr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Htr=(t,e)=>{let r={};return t[sge]!=null&&(r[sge]=t[sge]),r},Vtr=(t,e)=>{let r={};return t[Jme]!=null&&(r[Jme]=t[Jme]),t[Nme]!=null&&(r[Nme]=t[Nme]),r},Wtr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Vtr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Jtr=(t,e)=>{let r={};return t[zme]!=null&&(r[zme]=t[zme]),t[ige]!=null&&(r[ige]=t[ige]),r},Gtr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},irt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Jtr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},uge=(t,e)=>{let r={};return t[jme]!=null&&(r[jme]=Nr(t[jme])),t[Fx]!=null&&(r[Fx]=Nr(t[Fx])),r},Ktr=(t,e)=>{let r={};return t[Bd]!=null&&(r[Bd]=O2(t[Bd],e)),t[Lx]!=null&&(r[Lx]=uge(t[Lx],e)),t[jh]!=null&&(r[jh]=u2(t[jh])),t[Nh]!=null&&(r[Nh]=Nr(t[Nh])),r},Ytr=(t,e)=>{let r={};return t[Bd]!=null&&(r[Bd]=O2(t[Bd],e)),t[Lx]!=null&&(r[Lx]=uge(t[Lx],e)),t[jh]!=null&&(r[jh]=u2(t[jh])),t[Xme]!=null&&(r[Xme]=Nr(t[Xme])),t[tge]!=null&&(r[tge]=Nr(t[tge])),t[Ume]!=null&&(r[Ume]=Nr(t[Ume])),t[xL]!=null&&(r[xL]=Nr(t[xL])),t[Vme]!=null&&(r[Vme]=Nr(t[Vme])),t[Nh]!=null&&(r[Nh]=Nr(t[Nh])),r},Xtr=(t,e)=>{let r={};return t[Bd]!=null&&(r[Bd]=O2(t[Bd],e)),t[ege]!=null&&(r[ege]=Nr(t[ege])),t[Lx]!=null&&(r[Lx]=uge(t[Lx],e)),t[jh]!=null&&(r[jh]=u2(t[jh])),t[Yme]!=null&&(r[Yme]=Nr(t[Yme])),t[xL]!=null&&(r[xL]=Nr(t[xL])),t[Nh]!=null&&(r[Nh]=Nr(t[Nh])),r},O2=(t,e)=>{let r={};return t[wL]!=null&&(r[wL]=Nr(t[wL])),t[Zme]!=null&&(r[Zme]=Nr(t[Zme])),t[rge]!=null&&(r[rge]=Nr(t[rge])),t[Fme]!=null&&(r[Fme]=XN(m7e(t[Fme]))),r},Ztr=(t,e)=>{let r={};return t[Lme]!=null&&(r[Lme]=Nr(t[Lme])),r},Qtr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},err=(t,e)=>{let r={};return t[qme]!=null&&(r[qme]=Nr(t[qme])),t[Fx]!=null&&(r[Fx]=Nr(t[Fx])),r},trr=(t,e)=>{let r={};return t[SL]!=null&&(r[SL]=Nr(t[SL])),r},rrr=(t,e)=>{let r={};return t[oge]!=null&&(r[oge]=Nr(t[oge])),t[SL]!=null&&(r[SL]=Nr(t[SL])),t[Fx]!=null&&(r[Fx]=Nr(t[Fx])),r},nrr=(t,e)=>{let r={};return t[Bd]!=null&&(r[Bd]=O2(t[Bd],e)),t[$me]!=null&&(r[$me]=err(t[$me],e)),t[jh]!=null&&(r[jh]=u2(t[jh])),r},orr=(t,e)=>{let r={};return t[Bd]!=null&&(r[Bd]=O2(t[Bd],e)),r},irr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},arr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},srr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},urr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},lrr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},crr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},drr=(t,e)=>{let r={};return t[Vi]!=null&&(r[Vi]=Nr(t[Vi])),r},td=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),frr=vG(ic),fP=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new kR(l)},pP={"content-type":"application/x-www-form-urlencoded"},hP="2011-06-15",mP="Action",wL="AccessKeyId",prr="AssumeRole",jme="AssumedRoleId",Lx="AssumedRoleUser",hrr="AssumeRoleWithSAML",mrr="AssumeRoleWithWebIdentity",SL="Account",Fx="Arn",xL="Audience",Bd="Credentials",Nme="ContextAssertion",grr="DecodeAuthorizationMessage",Lme="DecodedMessage",$d="DurationSeconds",Fme="Expiration",kme="ExternalId",Bme="EncodedMessage",$me="FederatedUser",qme="FederatedUserId",yrr="GetAccessKeyInfo",brr="GetCallerIdentity",_rr="GetFederationToken",vrr="GetSessionToken",Ume="Issuer",zme="Key",Hme="Name",Vme="NameQualifier",Ih="Policy",Dh="PolicyArns",Wme="PrincipalArn",Jme="ProviderArn",Gme="ProvidedContexts",Kme="ProviderId",jh="PackedPolicySize",Yme="Provider",kx="RoleArn",CL="RoleSessionName",Xme="Subject",Zme="SecretAccessKey",Qme="SAMLAssertion",ege="SubjectFromWebIdentityToken",Nh="SourceIdentity",OL="SerialNumber",tge="SubjectType",rge="SessionToken",EL="Tags",PL="TokenCode",nge="TransitiveTagKeys",oge="UserId",gP="Version",ige="Value",age="WebIdentityToken",sge="arn",Vi="message",yP=t=>Object.entries(t).map(([e,r])=>CG(e)+"="+CG(r)).join("&"),wrr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var $x,CK=C(()=>{bn();On();Dt();hb();cP();Bx();$x=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,Pme).ser(ztt).de(Xtt).build(){}});var E2,lge=C(()=>{bn();On();Dt();hb();cP();Bx();E2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(Tme,Mme).ser(Htt).de(Ztt).build(){}});var JR,OK=C(()=>{bn();On();Dt();hb();cP();Bx();JR=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(Ame,Rme).ser(Vtt).de(Qtt).build(){}});var P2,cge=C(()=>{bn();On();Dt();hb();Bx();P2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(Wtt).de(ert).build(){}});var T2,dge=C(()=>{bn();On();Dt();hb();Bx();T2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(Jtt).de(trt).build(){}});var M2,fge=C(()=>{bn();On();Dt();hb();Bx();M2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(Gtt).de(rrt).build(){}});var A2,pge=C(()=>{bn();On();Dt();hb();cP();Bx();A2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,Ime).ser(Ktt).de(nrt).build(){}});var R2,hge=C(()=>{bn();On();Dt();hb();cP();Bx();R2=class extends it.classBuilder().ep({...Qc}).m(function(e,r,n,o){return[pt(n,this.serialize,this.deserialize),ht(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,Dme).ser(Ytt).de(ort).build(){}});var Srr,EK,art=C(()=>{Dt();CK();lge();OK();cge();dge();fge();pge();hge();C2();Srr={AssumeRoleCommand:$x,AssumeRoleWithSAMLCommand:E2,AssumeRoleWithWebIdentityCommand:JR,DecodeAuthorizationMessageCommand:P2,GetAccessKeyInfoCommand:T2,GetCallerIdentityCommand:M2,GetFederationTokenCommand:A2,GetSessionTokenCommand:R2},EK=class extends Rh{};bG(Srr,EK)});var srt=C(()=>{CK();lge();OK();cge();dge();fge();pge();hge()});var urt=C(()=>{cP()});var lrt,crt,drt,frt,prt,hrt,mrt=C(()=>{CK();OK();lrt="us-east-1",crt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},drt=async(t,e,r)=>{let n=typeof t=="function"?await t():t,o=typeof e=="function"?await e():e;return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (provider)`,`${o} (parent client)`,`${lrt} (STS default)`),n??o??lrt},frt=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:l=t?.parentClientConfig?.logger,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f}=t,p=await drt(c,t?.parentClientConfig?.region,f),h=!hrt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:h?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new $x(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=crt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},prt=(t,e)=>{let r;return async n=>{if(!r){let{logger:s=t?.parentClientConfig?.logger,region:u,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c}=t,d=await drt(u,t?.parentClientConfig?.region,c),f=!hrt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new JR(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=crt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},hrt=t=>t?.metadata?.handlerProtocol==="h2"});var grt,yrt,brt,xrr,_rt=C(()=>{mrt();C2();grt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,yrt=(t={},e)=>frt(t,grt(Rh,e)),brt=(t={},e)=>prt(t,grt(Rh,e)),xrr=t=>e=>t({roleAssumer:yrt(e),roleAssumerWithWebIdentity:brt(e),...e})});var vrt={};nf(vrt,{$Command:()=>it,AssumeRoleCommand:()=>$x,AssumeRoleResponseFilterSensitiveLog:()=>Pme,AssumeRoleWithSAMLCommand:()=>E2,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>Tme,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>Mme,AssumeRoleWithWebIdentityCommand:()=>JR,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>Ame,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>Rme,CredentialsFilterSensitiveLog:()=>vL,DecodeAuthorizationMessageCommand:()=>P2,ExpiredTokenException:()=>BR,GetAccessKeyInfoCommand:()=>T2,GetCallerIdentityCommand:()=>M2,GetFederationTokenCommand:()=>A2,GetFederationTokenResponseFilterSensitiveLog:()=>Ime,GetSessionTokenCommand:()=>R2,GetSessionTokenResponseFilterSensitiveLog:()=>Dme,IDPCommunicationErrorException:()=>VR,IDPRejectedClaimException:()=>zR,InvalidAuthorizationMessageException:()=>WR,InvalidIdentityTokenException:()=>HR,MalformedPolicyDocumentException:()=>$R,PackedPolicyTooLargeException:()=>qR,RegionDisabledException:()=>UR,STS:()=>EK,STSClient:()=>Rh,STSServiceException:()=>ic,__Client:()=>ER,decorateDefaultCredentialProvider:()=>xrr,getDefaultRoleAssumer:()=>yrt,getDefaultRoleAssumerWithWebIdentity:()=>brt});var mge=C(()=>{C2();art();srt();urt();_rt();SK()});var wrt={};nf(wrt,{AssumeRoleCommand:()=>$x,STSClient:()=>Rh});var Srt=C(()=>{mge()});var Crr,xrt=C(()=>{Mx();Crr=t=>{let e;return async()=>{t.logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let r={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(r?.SerialNumber){if(!t.mfaCodeProvider)throw new ns("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:t.logger});r.TokenCode=await t.mfaCodeProvider(r?.SerialNumber)}let{AssumeRoleCommand:n,STSClient:o}=await Promise.resolve().then(()=>(Srt(),wrt));if(e||(e=new o({...t.clientConfig,credentials:t.masterCredentials})),t.clientPlugins)for(let a of t.clientPlugins)e.middlewareStack.use(a);let{Credentials:i}=await e.send(new n(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new ns(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`,{logger:t.logger});return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,credentialScope:i.CredentialScope}}}});var Crt=C(()=>{});var Ort,Ert=C(()=>{Ort=t=>async()=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:e,roleSessionName:r,webIdentityToken:n,providerId:o,policyArns:i,policy:a,durationSeconds:s}=t,{roleAssumerWithWebIdentity:u}=t;if(!u){let{getDefaultRoleAssumerWithWebIdentity:l}=await Promise.resolve().then(()=>(mge(),vrt));u=l({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:t.parentClientConfig},t.clientPlugins)}return u({RoleArn:e,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:o,PolicyArns:i,Policy:a,DurationSeconds:s})}});var Prt=C(()=>{Crt();Ert()});var Orr,Trt=C(()=>{Prt();Orr=t=>Ort({...t})});var Mrt={};nf(Mrt,{fromCognitoIdentity:()=>ytr,fromCognitoIdentityPool:()=>btr,fromHttp:()=>vme,fromTemporaryCredentials:()=>Crr,fromWebToken:()=>Orr});var Art=C(()=>{vet();wet();qet();xrt();Trt()});var GR={};nf(GR,{__addDisposableResource:()=>Xrt,__assign:()=>PK,__asyncDelegator:()=>zrt,__asyncGenerator:()=>Urt,__asyncValues:()=>Hrt,__await:()=>TL,__awaiter:()=>Lrt,__classPrivateFieldGet:()=>Grt,__classPrivateFieldIn:()=>Yrt,__classPrivateFieldSet:()=>Krt,__createBinding:()=>MK,__decorate:()=>Drt,__disposeResources:()=>Zrt,__esDecorate:()=>Err,__exportStar:()=>krt,__extends:()=>Rrt,__generator:()=>Frt,__importDefault:()=>Jrt,__importStar:()=>Wrt,__makeTemplateObject:()=>Vrt,__metadata:()=>Nrt,__param:()=>jrt,__propKey:()=>Trr,__read:()=>yge,__rest:()=>Irt,__runInitializers:()=>Prr,__setFunctionName:()=>Mrr,__spread:()=>Brt,__spreadArray:()=>qrt,__spreadArrays:()=>$rt,__values:()=>TK,default:()=>Irr});function Rrt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");gge(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Irt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function Drt(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function jrt(t,e){return function(r,n){e(r,n,t)}}function Err(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var 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 v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Prr(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function Trr(t){return typeof t=="symbol"?t:"".concat(t)}function Mrr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Nrt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Lrt(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function Frt(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function krt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MK(e,t,r)}function TK(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yge(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Brt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(yge(arguments[e]));return t}function $rt(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function qrt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function TL(t){return this instanceof TL?(this.v=t,this):new TL(t)}function Urt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(v,g){i.push([p,m,v,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 TL?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 zrt(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:TL(t[o](a)),done:!1}:i?i(a):a}:i}}function Hrt(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof TK=="function"?TK(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function Vrt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Wrt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MK(e,t,r);return Arr(e,t),e}function Jrt(t){return t&&t.__esModule?t:{default:t}}function Grt(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Krt(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function Yrt(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Xrt(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Zrt(t){function e(i){t.error=t.hasError?new Rrr(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var gge,PK,MK,Arr,Rrr,Irr,KR=C(()=>{gge=function(t,e){return gge=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])},gge(t,e)};PK=function(){return PK=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},PK.apply(this,arguments)};MK=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};Arr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Rrr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Irr={__extends:Rrt,__assign:PK,__rest:Irt,__decorate:Drt,__param:jrt,__metadata:Nrt,__awaiter:Lrt,__generator:Frt,__createBinding:MK,__exportStar:krt,__values:TK,__read:yge,__spread:Brt,__spreadArrays:$rt,__spreadArray:qrt,__await:TL,__asyncGenerator:Urt,__asyncDelegator:zrt,__asyncValues:Hrt,__makeTemplateObject:Vrt,__importStar:Wrt,__importDefault:Jrt,__classPrivateFieldGet:Grt,__classPrivateFieldSet:Krt,__classPrivateFieldIn:Yrt,__addDisposableResource:Xrt,__disposeResources:Zrt}});var ent=b(Qrt=>{"use strict";Object.defineProperty(Qrt,"__esModule",{value:!0})});var tnt=b(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});I2.HttpAuthLocation=void 0;var Drr;(function(t){t.HEADER="header",t.QUERY="query"})(Drr=I2.HttpAuthLocation||(I2.HttpAuthLocation={}))});var nnt=b(rnt=>{"use strict";Object.defineProperty(rnt,"__esModule",{value:!0})});var int=b(ont=>{"use strict";Object.defineProperty(ont,"__esModule",{value:!0})});var snt=b(ant=>{"use strict";Object.defineProperty(ant,"__esModule",{value:!0})});var lnt=b(unt=>{"use strict";Object.defineProperty(unt,"__esModule",{value:!0})});var dnt=b(cnt=>{"use strict";Object.defineProperty(cnt,"__esModule",{value:!0})});var pnt=b(fnt=>{"use strict";Object.defineProperty(fnt,"__esModule",{value:!0})});var mnt=b(hnt=>{"use strict";Object.defineProperty(hnt,"__esModule",{value:!0})});var gnt=b(D2=>{"use strict";Object.defineProperty(D2,"__esModule",{value:!0});var bge=(KR(),ml(GR));bge.__exportStar(dnt(),D2);bge.__exportStar(pnt(),D2);bge.__exportStar(mnt(),D2)});var bnt=b(ynt=>{"use strict";Object.defineProperty(ynt,"__esModule",{value:!0})});var vnt=b(_nt=>{"use strict";Object.defineProperty(_nt,"__esModule",{value:!0})});var wnt=b(j2=>{"use strict";Object.defineProperty(j2,"__esModule",{value:!0});j2.EndpointURLScheme=void 0;var jrr;(function(t){t.HTTP="http",t.HTTPS="https"})(jrr=j2.EndpointURLScheme||(j2.EndpointURLScheme={}))});var xnt=b(Snt=>{"use strict";Object.defineProperty(Snt,"__esModule",{value:!0})});var Ont=b(Cnt=>{"use strict";Object.defineProperty(Cnt,"__esModule",{value:!0})});var Pnt=b(Ent=>{"use strict";Object.defineProperty(Ent,"__esModule",{value:!0})});var Mnt=b(Tnt=>{"use strict";Object.defineProperty(Tnt,"__esModule",{value:!0})});var Rnt=b(Ant=>{"use strict";Object.defineProperty(Ant,"__esModule",{value:!0})});var Int=b(YR=>{"use strict";Object.defineProperty(YR,"__esModule",{value:!0});var N2=(KR(),ml(GR));N2.__exportStar(xnt(),YR);N2.__exportStar(Ont(),YR);N2.__exportStar(Pnt(),YR);N2.__exportStar(Mnt(),YR);N2.__exportStar(Rnt(),YR)});var jnt=b(Dnt=>{"use strict";Object.defineProperty(Dnt,"__esModule",{value:!0})});var Nnt=b(L2=>{"use strict";Object.defineProperty(L2,"__esModule",{value:!0});L2.FieldPosition=void 0;var Nrr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Nrr=L2.FieldPosition||(L2.FieldPosition={}))});var Fnt=b(Lnt=>{"use strict";Object.defineProperty(Lnt,"__esModule",{value:!0})});var Bnt=b(knt=>{"use strict";Object.defineProperty(knt,"__esModule",{value:!0})});var qnt=b(AK=>{"use strict";Object.defineProperty(AK,"__esModule",{value:!0});var $nt=(KR(),ml(GR));$nt.__exportStar(Fnt(),AK);$nt.__exportStar(Bnt(),AK)});var znt=b(Unt=>{"use strict";Object.defineProperty(Unt,"__esModule",{value:!0})});var Vnt=b(Hnt=>{"use strict";Object.defineProperty(Hnt,"__esModule",{value:!0})});var Jnt=b(Wnt=>{"use strict";Object.defineProperty(Wnt,"__esModule",{value:!0})});var Knt=b(Gnt=>{"use strict";Object.defineProperty(Gnt,"__esModule",{value:!0})});var Xnt=b(Ynt=>{"use strict";Object.defineProperty(Ynt,"__esModule",{value:!0})});var Qnt=b(Znt=>{"use strict";Object.defineProperty(Znt,"__esModule",{value:!0})});var tot=b(eot=>{"use strict";Object.defineProperty(eot,"__esModule",{value:!0})});var not=b(rot=>{"use strict";Object.defineProperty(rot,"__esModule",{value:!0})});var iot=b(oot=>{"use strict";Object.defineProperty(oot,"__esModule",{value:!0})});var sot=b(aot=>{"use strict";Object.defineProperty(aot,"__esModule",{value:!0})});var lot=b(uot=>{"use strict";Object.defineProperty(uot,"__esModule",{value:!0})});var dot=b(cot=>{"use strict";Object.defineProperty(cot,"__esModule",{value:!0})});var pot=b(fot=>{"use strict";Object.defineProperty(fot,"__esModule",{value:!0})});var hot=b(F2=>{"use strict";Object.defineProperty(F2,"__esModule",{value:!0});F2.RequestHandlerProtocol=void 0;var Lrr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(Lrr=F2.RequestHandlerProtocol||(F2.RequestHandlerProtocol={}))});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 Oot=b(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var Bn=(KR(),ml(GR));Bn.__exportStar(ent(),_n);Bn.__exportStar(tnt(),_n);Bn.__exportStar(nnt(),_n);Bn.__exportStar(int(),_n);Bn.__exportStar(snt(),_n);Bn.__exportStar(lnt(),_n);Bn.__exportStar(gnt(),_n);Bn.__exportStar(bnt(),_n);Bn.__exportStar(vnt(),_n);Bn.__exportStar(wnt(),_n);Bn.__exportStar(Int(),_n);Bn.__exportStar(jnt(),_n);Bn.__exportStar(Nnt(),_n);Bn.__exportStar(qnt(),_n);Bn.__exportStar(znt(),_n);Bn.__exportStar(Vnt(),_n);Bn.__exportStar(Jnt(),_n);Bn.__exportStar(Knt(),_n);Bn.__exportStar(Xnt(),_n);Bn.__exportStar(Qnt(),_n);Bn.__exportStar(tot(),_n);Bn.__exportStar(not(),_n);Bn.__exportStar(iot(),_n);Bn.__exportStar(sot(),_n);Bn.__exportStar(lot(),_n);Bn.__exportStar(dot(),_n);Bn.__exportStar(pot(),_n);Bn.__exportStar(hot(),_n);Bn.__exportStar(got(),_n);Bn.__exportStar(bot(),_n);Bn.__exportStar(vot(),_n);Bn.__exportStar(Sot(),_n);Bn.__exportStar(Cot(),_n)});var Eot=b(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.Field=void 0;var Frr=Oot(),_ge=class{constructor({name:e,kind:r=Frr.FieldPosition.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}};RK.Field=_ge});var Pot=b(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.Fields=void 0;var vge=class{constructor({fields:e=[],encoding:r="utf-8"}){this.entries={},e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}};IK.Fields=vge});var Mot=b(Tot=>{"use strict";Object.defineProperty(Tot,"__esModule",{value:!0})});var Aot=b(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.HttpRequest=void 0;var k2=class{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){let e=new k2({...this,headers:{...this.headers}});return e.query&&(e.query=krr(e.query)),e}};DK.HttpRequest=k2;function krr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var Rot=b(jK=>{"use strict";Object.defineProperty(jK,"__esModule",{value:!0});jK.HttpResponse=void 0;var wge=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};jK.HttpResponse=wge});var Iot=b(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.isValidHostname=void 0;function Brr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}NK.isValidHostname=Brr});var jot=b(Dot=>{"use strict";Object.defineProperty(Dot,"__esModule",{value:!0})});var Not=b(qx=>{"use strict";Object.defineProperty(qx,"__esModule",{value:!0});var XR=(KR(),ml(GR));XR.__exportStar(Eot(),qx);XR.__exportStar(Pot(),qx);XR.__exportStar(Mot(),qx);XR.__exportStar(Aot(),qx);XR.__exportStar(Rot(),qx);XR.__exportStar(Iot(),qx);XR.__exportStar(jot(),qx)});var Lot=b(Sge=>{"use strict";Object.defineProperty(Sge,"__esModule",{value:!0});var $rr=(KR(),ml(GR));$rr.__exportStar(Not(),Sge)});var ZR={};nf(ZR,{__addDisposableResource:()=>nit,__assign:()=>LK,__asyncDelegator:()=>Kot,__asyncGenerator:()=>Got,__asyncValues:()=>Yot,__await:()=>ML,__awaiter:()=>Uot,__classPrivateFieldGet:()=>eit,__classPrivateFieldIn:()=>rit,__classPrivateFieldSet:()=>tit,__createBinding:()=>kK,__decorate:()=>Bot,__disposeResources:()=>oit,__esDecorate:()=>qrr,__exportStar:()=>Hot,__extends:()=>Fot,__generator:()=>zot,__importDefault:()=>Qot,__importStar:()=>Zot,__makeTemplateObject:()=>Xot,__metadata:()=>qot,__param:()=>$ot,__propKey:()=>zrr,__read:()=>Cge,__rest:()=>kot,__runInitializers:()=>Urr,__setFunctionName:()=>Hrr,__spread:()=>Vot,__spreadArray:()=>Jot,__spreadArrays:()=>Wot,__values:()=>FK,default:()=>Jrr});function Fot(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");xge(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function kot(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function Bot(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function $ot(t,e){return function(r,n){e(r,n,t)}}function qrr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var 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 v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Urr(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function zrr(t){return typeof t=="symbol"?t:"".concat(t)}function Hrr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function qot(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Uot(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function zot(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Hot(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kK(e,t,r)}function FK(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Cge(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Vot(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Cge(arguments[e]));return t}function Wot(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Jot(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function ML(t){return this instanceof ML?(this.v=t,this):new ML(t)}function Got(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(v,g){i.push([p,m,v,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 ML?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 Kot(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:ML(t[o](a)),done:!1}:i?i(a):a}:i}}function Yot(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof FK=="function"?FK(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function Xot(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Zot(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kK(e,t,r);return Vrr(e,t),e}function Qot(t){return t&&t.__esModule?t:{default:t}}function eit(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function tit(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function rit(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function nit(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function oit(t){function e(i){t.error=t.hasError?new Wrr(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var xge,LK,kK,Vrr,Wrr,Jrr,QR=C(()=>{xge=function(t,e){return xge=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])},xge(t,e)};LK=function(){return LK=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},LK.apply(this,arguments)};kK=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};Vrr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Wrr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Jrr={__extends:Fot,__assign:LK,__rest:kot,__decorate:Bot,__param:$ot,__metadata:qot,__awaiter:Uot,__generator:zot,__createBinding:kK,__exportStar:Hot,__values:FK,__read:Cge,__spread:Vot,__spreadArrays:Wot,__spreadArray:Jot,__await:ML,__asyncGenerator:Got,__asyncDelegator:Kot,__asyncValues:Yot,__makeTemplateObject:Xot,__importStar:Zot,__importDefault:Qot,__classPrivateFieldGet:eit,__classPrivateFieldSet:tit,__classPrivateFieldIn:rit,__addDisposableResource:nit,__disposeResources:oit}});var Tge={};nf(Tge,{__assign:()=>Ege,__asyncDelegator:()=>anr,__asyncGenerator:()=>inr,__asyncValues:()=>snr,__await:()=>B2,__awaiter:()=>Qrr,__classPrivateFieldGet:()=>dnr,__classPrivateFieldSet:()=>fnr,__createBinding:()=>tnr,__decorate:()=>Yrr,__exportStar:()=>rnr,__extends:()=>Grr,__generator:()=>enr,__importDefault:()=>cnr,__importStar:()=>lnr,__makeTemplateObject:()=>unr,__metadata:()=>Zrr,__param:()=>Xrr,__read:()=>iit,__rest:()=>Krr,__spread:()=>nnr,__spreadArrays:()=>onr,__values:()=>Pge});function Grr(t,e){Oge(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Krr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function Yrr(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Xrr(t,e){return function(r,n){e(r,n,t)}}function Zrr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Qrr(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function enr(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function tnr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function rnr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Pge(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function iit(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function nnr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(iit(arguments[e]));return t}function onr(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function B2(t){return this instanceof B2?(this.v=t,this):new B2(t)}function inr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof B2?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 anr(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:B2(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function snr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Pge=="function"?Pge(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function unr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function lnr(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function cnr(t){return t&&t.__esModule?t:{default:t}}function dnr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function fnr(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var Oge,Ege,Mge=C(()=>{Oge=function(t,e){return Oge=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])},Oge(t,e)};Ege=function(){return Ege=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ege.apply(this,arguments)}});var ait=b(AL=>{"use strict";Object.defineProperty(AL,"__esModule",{value:!0});AL.toUtf8=AL.fromUtf8=void 0;var pnr=t=>{let e=[];for(let r=0,n=t.length;r<n;r++){let o=t.charCodeAt(r);if(o<128)e.push(o);else if(o<2048)e.push(o>>6|192,o&63|128);else if(r+1<t.length&&(o&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320){let i=65536+((o&1023)<<10)+(t.charCodeAt(++r)&1023);e.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else e.push(o>>12|224,o>>6&63|128,o&63|128)}return Uint8Array.from(e)};AL.fromUtf8=pnr;var hnr=t=>{let e="";for(let r=0,n=t.length;r<n;r++){let o=t[r];if(o<128)e+=String.fromCharCode(o);else if(192<=o&&o<224){let i=t[++r];e+=String.fromCharCode((o&31)<<6|i&63)}else if(240<=o&&o<365){let a="%"+[o,t[++r],t[++r],t[++r]].map(s=>s.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((o&15)<<12|(t[++r]&63)<<6|t[++r]&63)}return e};AL.toUtf8=hnr});var sit=b(RL=>{"use strict";Object.defineProperty(RL,"__esModule",{value:!0});RL.toUtf8=RL.fromUtf8=void 0;function mnr(t){return new TextEncoder().encode(t)}RL.fromUtf8=mnr;function gnr(t){return new TextDecoder("utf-8").decode(t)}RL.toUtf8=gnr});var cit=b(IL=>{"use strict";Object.defineProperty(IL,"__esModule",{value:!0});IL.toUtf8=IL.fromUtf8=void 0;var uit=ait(),lit=sit(),ynr=t=>typeof TextEncoder=="function"?(0,lit.fromUtf8)(t):(0,uit.fromUtf8)(t);IL.fromUtf8=ynr;var bnr=t=>typeof TextDecoder=="function"?(0,lit.toUtf8)(t):(0,uit.toUtf8)(t);IL.toUtf8=bnr});var dit=b(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.convertToBuffer=void 0;var _nr=cit(),vnr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:_nr.fromUtf8;function wnr(t){return t instanceof Uint8Array?t:typeof t=="string"?vnr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}BK.convertToBuffer=wnr});var fit=b($K=>{"use strict";Object.defineProperty($K,"__esModule",{value:!0});$K.isEmptyData=void 0;function Snr(t){return typeof t=="string"?t.length===0:t.byteLength===0}$K.isEmptyData=Snr});var pit=b(qK=>{"use strict";Object.defineProperty(qK,"__esModule",{value:!0});qK.numToUint8=void 0;function xnr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}qK.numToUint8=xnr});var hit=b(UK=>{"use strict";Object.defineProperty(UK,"__esModule",{value:!0});UK.uint32ArrayFrom=void 0;function Cnr(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}UK.uint32ArrayFrom=Cnr});var Age=b(gb=>{"use strict";Object.defineProperty(gb,"__esModule",{value:!0});gb.uint32ArrayFrom=gb.numToUint8=gb.isEmptyData=gb.convertToBuffer=void 0;var Onr=dit();Object.defineProperty(gb,"convertToBuffer",{enumerable:!0,get:function(){return Onr.convertToBuffer}});var Enr=fit();Object.defineProperty(gb,"isEmptyData",{enumerable:!0,get:function(){return Enr.isEmptyData}});var Pnr=pit();Object.defineProperty(gb,"numToUint8",{enumerable:!0,get:function(){return Pnr.numToUint8}});var Tnr=hit();Object.defineProperty(gb,"uint32ArrayFrom",{enumerable:!0,get:function(){return Tnr.uint32ArrayFrom}})});var yit=b(zK=>{"use strict";Object.defineProperty(zK,"__esModule",{value:!0});zK.AwsCrc32=void 0;var mit=(Mge(),ml(Tge)),Rge=Age(),git=HK(),Mnr=function(){function t(){this.crc32=new git.Crc32}return t.prototype.update=function(e){(0,Rge.isEmptyData)(e)||this.crc32.update((0,Rge.convertToBuffer)(e))},t.prototype.digest=function(){return mit.__awaiter(this,void 0,void 0,function(){return mit.__generator(this,function(e){return[2,(0,Rge.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new git.Crc32},t}();zK.AwsCrc32=Mnr});var HK=b(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});bP.AwsCrc32=bP.Crc32=bP.crc32=void 0;var Anr=(Mge(),ml(Tge)),Rnr=Age();function Inr(t){return new bit().update(t).digest()}bP.crc32=Inr;var bit=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=Anr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^jnr[(this.checksum^a)&255]}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t}();bP.Crc32=bit;var Dnr=[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],jnr=(0,Rnr.uint32ArrayFrom)(Dnr),Nnr=yit();Object.defineProperty(bP,"AwsCrc32",{enumerable:!0,get:function(){return Nnr.AwsCrc32}})});var jL=b(DL=>{"use strict";Object.defineProperty(DL,"__esModule",{value:!0});DL.toHex=DL.fromHex=void 0;var _it={},Ige={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),_it[t]=e,Ige[e]=t}function Lnr(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in Ige)e[r/2]=Ige[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}DL.fromHex=Lnr;function Fnr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=_it[t[r]];return e}DL.toHex=Fnr});var Dge=b(VK=>{"use strict";Object.defineProperty(VK,"__esModule",{value:!0});VK.Int64=void 0;var knr=jL(),$2=class{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&vit(r),new $2(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&vit(e),parseInt((0,knr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};VK.Int64=$2;function vit(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var Lge=b(WK=>{"use strict";Object.defineProperty(WK,"__esModule",{value:!0});WK.HeaderMarshaller=void 0;var NL=jL(),jge=Dge(),Nge=class{constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i of Object.keys(e)){let a=this.fromUtf8(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=this.fromUtf8(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(jge.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Jnr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,NL.fromHex)(e.value.replace(/\-/g,"")),1),d}}parse(e){let r={},n=0;for(;n<e.byteLength;){let o=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,o));switch(n+=o,e.getUint8(n++)){case 0:r[i]={type:Sit,value:!0};break;case 1:r[i]={type:Sit,value:!1};break;case 2:r[i]={type:Bnr,value:e.getInt8(n++)};break;case 3:r[i]={type:$nr,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:qnr,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:Unr,value:new jge.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let a=e.getUint16(n,!1);n+=2,r[i]={type:znr,value:new Uint8Array(e.buffer,e.byteOffset+n,a)},n+=a;break;case 7:let s=e.getUint16(n,!1);n+=2,r[i]={type:Hnr,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:Vnr,value:new Date(new jge.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let u=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[i]={type:Wnr,value:`${(0,NL.toHex)(u.subarray(0,4))}-${(0,NL.toHex)(u.subarray(4,6))}-${(0,NL.toHex)(u.subarray(6,8))}-${(0,NL.toHex)(u.subarray(8,10))}-${(0,NL.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};WK.HeaderMarshaller=Nge;var wit;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(wit||(wit={}));var Sit="boolean",Bnr="byte",$nr="short",qnr="integer",Unr="long",znr="binary",Hnr="string",Vnr="timestamp",Wnr="uuid",Jnr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var Cit=b(JK=>{"use strict";Object.defineProperty(JK,"__esModule",{value:!0});JK.splitMessage=void 0;var Gnr=HK(),xit=4,_P=xit*2,eI=4,Knr=_P+eI*2;function Ynr({byteLength:t,byteOffset:e,buffer:r}){if(t<Knr)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),o=n.getUint32(0,!1);if(t!==o)throw new Error("Reported message length does not match received message length");let i=n.getUint32(xit,!1),a=n.getUint32(_P,!1),s=n.getUint32(t-eI,!1),u=new Gnr.Crc32().update(new Uint8Array(r,e,_P));if(a!==u.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${u.digest()})`);if(u.update(new Uint8Array(r,e+_P,t-(_P+eI))),s!==u.digest())throw new Error(`The message checksum (${u.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(r,e+_P+eI,i),body:new Uint8Array(r,e+_P+eI+i,o-i-(_P+eI+eI))}}JK.splitMessage=Ynr});var Oit=b(GK=>{"use strict";Object.defineProperty(GK,"__esModule",{value:!0});GK.EventStreamCodec=void 0;var Xnr=HK(),Znr=Lge(),Qnr=Cit(),Fge=class{constructor(e,r){this.headerMarshaller=new Znr.HeaderMarshaller(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),o=n.byteLength+r.byteLength+16,i=new Uint8Array(o),a=new DataView(i.buffer,i.byteOffset,i.byteLength),s=new Xnr.Crc32;return a.setUint32(0,o,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,s.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(r,n.byteLength+12),a.setUint32(o-4,s.update(i.subarray(8,o-4)).digest(),!1),i}decode(e){let{headers:r,body:n}=(0,Qnr.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};GK.EventStreamCodec=Fge});var Pit=b(Eit=>{"use strict";Object.defineProperty(Eit,"__esModule",{value:!0})});var Tit=b(KK=>{"use strict";Object.defineProperty(KK,"__esModule",{value:!0});KK.MessageDecoderStream=void 0;var kge=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}};KK.MessageDecoderStream=kge});var Mit=b(YK=>{"use strict";Object.defineProperty(YK,"__esModule",{value:!0});YK.MessageEncoderStream=void 0;var Bge=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}};YK.MessageEncoderStream=Bge});var Ait=b(XK=>{"use strict";Object.defineProperty(XK,"__esModule",{value:!0});XK.SmithyMessageDecoderStream=void 0;var $ge=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}};XK.SmithyMessageDecoderStream=$ge});var Rit=b(ZK=>{"use strict";Object.defineProperty(ZK,"__esModule",{value:!0});ZK.SmithyMessageEncoderStream=void 0;var qge=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};ZK.SmithyMessageEncoderStream=qge});var Iit=b(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});var vP=(QR(),ml(ZR));vP.__exportStar(Oit(),yb);vP.__exportStar(Lge(),yb);vP.__exportStar(Dge(),yb);vP.__exportStar(Pit(),yb);vP.__exportStar(Tit(),yb);vP.__exportStar(Mit(),yb);vP.__exportStar(Ait(),yb);vP.__exportStar(Rit(),yb)});var Dit=b(QK=>{"use strict";Object.defineProperty(QK,"__esModule",{value:!0});QK.normalizeProvider=void 0;var eor=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};QK.normalizeProvider=eor});var jit=b(Uge=>{"use strict";Object.defineProperty(Uge,"__esModule",{value:!0});var tor=(QR(),ml(ZR));tor.__exportStar(Dit(),Uge)});var zge=b(e7=>{"use strict";Object.defineProperty(e7,"__esModule",{value:!0});e7.isArrayBuffer=void 0;var ror=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";e7.isArrayBuffer=ror});var Vge=b(LL=>{"use strict";Object.defineProperty(LL,"__esModule",{value:!0});LL.fromString=LL.fromArrayBuffer=void 0;var nor=zge(),Hge=hg(),oor=(t,e=0,r=t.byteLength-e)=>{if(!(0,nor.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Hge.Buffer.from(t,e,r)};LL.fromArrayBuffer=oor;var ior=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Hge.Buffer.from(t,e):Hge.Buffer.from(t)};LL.fromString=ior});var Wge=b(t7=>{"use strict";Object.defineProperty(t7,"__esModule",{value:!0});t7.fromUtf8=void 0;var aor=Vge(),sor=t=>{let e=(0,aor.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};t7.fromUtf8=sor});var Nit=b(r7=>{"use strict";Object.defineProperty(r7,"__esModule",{value:!0});r7.toUint8Array=void 0;var uor=Wge(),lor=t=>typeof t=="string"?(0,uor.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);r7.toUint8Array=lor});var Lit=b(n7=>{"use strict";Object.defineProperty(n7,"__esModule",{value:!0});n7.toUtf8=void 0;var cor=Vge(),dor=t=>(0,cor.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");n7.toUtf8=dor});var o7=b(q2=>{"use strict";Object.defineProperty(q2,"__esModule",{value:!0});var Jge=(QR(),ml(ZR));Jge.__exportStar(Wge(),q2);Jge.__exportStar(Nit(),q2);Jge.__exportStar(Lit(),q2)});var tI=b(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.MAX_PRESIGNED_TTL=mt.KEY_TYPE_IDENTIFIER=mt.MAX_CACHE_SIZE=mt.UNSIGNED_PAYLOAD=mt.EVENT_ALGORITHM_IDENTIFIER=mt.ALGORITHM_IDENTIFIER_V4A=mt.ALGORITHM_IDENTIFIER=mt.UNSIGNABLE_PATTERNS=mt.SEC_HEADER_PATTERN=mt.PROXY_HEADER_PATTERN=mt.ALWAYS_UNSIGNABLE_HEADERS=mt.HOST_HEADER=mt.TOKEN_HEADER=mt.SHA256_HEADER=mt.SIGNATURE_HEADER=mt.GENERATED_HEADERS=mt.DATE_HEADER=mt.AMZ_DATE_HEADER=mt.AUTH_HEADER=mt.REGION_SET_PARAM=mt.TOKEN_QUERY_PARAM=mt.SIGNATURE_QUERY_PARAM=mt.EXPIRES_QUERY_PARAM=mt.SIGNED_HEADERS_QUERY_PARAM=mt.AMZ_DATE_QUERY_PARAM=mt.CREDENTIAL_QUERY_PARAM=mt.ALGORITHM_QUERY_PARAM=void 0;mt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";mt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";mt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";mt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";mt.EXPIRES_QUERY_PARAM="X-Amz-Expires";mt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";mt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";mt.REGION_SET_PARAM="X-Amz-Region-Set";mt.AUTH_HEADER="authorization";mt.AMZ_DATE_HEADER=mt.AMZ_DATE_QUERY_PARAM.toLowerCase();mt.DATE_HEADER="date";mt.GENERATED_HEADERS=[mt.AUTH_HEADER,mt.AMZ_DATE_HEADER,mt.DATE_HEADER];mt.SIGNATURE_HEADER=mt.SIGNATURE_QUERY_PARAM.toLowerCase();mt.SHA256_HEADER="x-amz-content-sha256";mt.TOKEN_HEADER=mt.TOKEN_QUERY_PARAM.toLowerCase();mt.HOST_HEADER="host";mt.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};mt.PROXY_HEADER_PATTERN=/^proxy-/;mt.SEC_HEADER_PATTERN=/^sec-/;mt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];mt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";mt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";mt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";mt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";mt.MAX_CACHE_SIZE=50;mt.KEY_TYPE_IDENTIFIER="aws4_request";mt.MAX_PRESIGNED_TTL=60*60*24*7});var Kge=b(wP=>{"use strict";Object.defineProperty(wP,"__esModule",{value:!0});wP.clearCredentialCache=wP.getSigningKey=wP.createScope=void 0;var por=jL(),hor=o7(),Gge=tI(),FL={},i7=[],mor=(t,e,r)=>`${t}/${e}/${r}/${Gge.KEY_TYPE_IDENTIFIER}`;wP.createScope=mor;var gor=async(t,e,r,n,o)=>{let i=await Fit(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,por.toHex)(i)}:${e.sessionToken}`;if(a in FL)return FL[a];for(i7.push(a);i7.length>Gge.MAX_CACHE_SIZE;)delete FL[i7.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Gge.KEY_TYPE_IDENTIFIER])s=await Fit(t,s,u);return FL[a]=s};wP.getSigningKey=gor;var yor=()=>{i7.length=0,Object.keys(FL).forEach(t=>{delete FL[t]})};wP.clearCredentialCache=yor;var Fit=(t,e,r)=>{let n=new t(e);return n.update((0,hor.toUint8Array)(r)),n.digest()}});var Xge=b(a7=>{"use strict";Object.defineProperty(a7,"__esModule",{value:!0});a7.getCanonicalHeaders=void 0;var Yge=tI(),bor=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in Yge.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||Yge.PROXY_HEADER_PATTERN.test(i)||Yge.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};a7.getCanonicalHeaders=bor});var Zge=b(s7=>{"use strict";Object.defineProperty(s7,"__esModule",{value:!0});s7.escapeUri=void 0;var _or=t=>encodeURIComponent(t).replace(/[!'()*]/g,vor);s7.escapeUri=_or;var vor=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var kit=b(u7=>{"use strict";Object.defineProperty(u7,"__esModule",{value:!0});u7.escapeUriPath=void 0;var wor=Zge(),Sor=t=>t.split("/").map(wor.escapeUri).join("/");u7.escapeUriPath=Sor});var $it=b(l7=>{"use strict";Object.defineProperty(l7,"__esModule",{value:!0});var Bit=(QR(),ml(ZR));Bit.__exportStar(Zge(),l7);Bit.__exportStar(kit(),l7)});var Qge=b(d7=>{"use strict";Object.defineProperty(d7,"__esModule",{value:!0});d7.getCanonicalQuery=void 0;var c7=$it(),xor=tI(),Cor=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===xor.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,c7.escapeUri)(n)}=${(0,c7.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,c7.escapeUri)(n)}=${(0,c7.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};d7.getCanonicalQuery=Cor});var eye=b(f7=>{"use strict";Object.defineProperty(f7,"__esModule",{value:!0});f7.getPayloadHash=void 0;var Oor=zge(),Eor=jL(),Por=o7(),qit=tI(),Tor=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===qit.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,Oor.isArrayBuffer)(e)){let n=new r;return n.update((0,Por.toUint8Array)(e)),(0,Eor.toHex)(await n.digest())}return qit.UNSIGNED_PAYLOAD};f7.getPayloadHash=Tor});var Uit=b(SP=>{"use strict";Object.defineProperty(SP,"__esModule",{value:!0});SP.deleteHeader=SP.getHeaderValue=SP.hasHeader=void 0;var Mor=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};SP.hasHeader=Mor;var Aor=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};SP.getHeaderValue=Aor;var Ror=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};SP.deleteHeader=Ror});var tye=b(rI=>{"use strict";Object.defineProperty(rI,"__esModule",{value:!0});rI.cloneQuery=rI.cloneRequest=void 0;var Ior=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,rI.cloneQuery)(e):void 0});rI.cloneRequest=Ior;var Dor=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});rI.cloneQuery=Dor});var rye=b(p7=>{"use strict";Object.defineProperty(p7,"__esModule",{value:!0});p7.moveHeadersToQuery=void 0;var jor=tye(),Nor=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,jor.cloneRequest)(t);for(let i of Object.keys(n)){let a=i.toLowerCase();a.slice(0,6)==="x-amz-"&&!(!((r=e.unhoistableHeaders)===null||r===void 0)&&r.has(a))&&(o[i]=n[i],delete n[i])}return{...t,headers:n,query:o}};p7.moveHeadersToQuery=Nor});var nye=b(h7=>{"use strict";Object.defineProperty(h7,"__esModule",{value:!0});h7.prepareRequest=void 0;var Lor=tye(),For=tI(),kor=t=>{t=typeof t.clone=="function"?t.clone():(0,Lor.cloneRequest)(t);for(let e of Object.keys(t.headers))For.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};h7.prepareRequest=kor});var zit=b(nI=>{"use strict";Object.defineProperty(nI,"__esModule",{value:!0});nI.toDate=nI.iso8601=void 0;var Bor=t=>(0,nI.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");nI.iso8601=Bor;var $or=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;nI.toDate=$or});var Git=b(b7=>{"use strict";Object.defineProperty(b7,"__esModule",{value:!0});b7.SignatureV4=void 0;var qor=Iit(),m7=jL(),Hit=jit(),U2=o7(),ac=tI(),g7=Kge(),Vit=Xge(),Uor=Qge(),oye=eye(),zor=Uit(),Hor=rye(),Wit=nye(),Vor=zit(),iye=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new qor.HeaderMarshaller(U2.toUtf8,U2.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,Hit.normalizeProvider)(n),this.credentialProvider=(0,Hit.normalizeProvider)(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=y7(n);if(o>ac.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=(0,g7.createScope)(p,d,l??this.service),m=(0,Hor.moveHeadersToQuery)((0,Wit.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[ac.TOKEN_QUERY_PARAM]=c.sessionToken),m.query[ac.ALGORITHM_QUERY_PARAM]=ac.ALGORITHM_IDENTIFIER,m.query[ac.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${h}`,m.query[ac.AMZ_DATE_QUERY_PARAM]=f,m.query[ac.EXPIRES_QUERY_PARAM]=o.toString(10);let v=(0,Vit.getCanonicalHeaders)(m,i,s);return m.query[ac.SIGNED_HEADERS_QUERY_PARAM]=Jit(v),m.query[ac.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,v,await(0,oye.getPayloadHash)(e,this.sha256))),m}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=y7(n),c=(0,g7.createScope)(u,s,a??this.service),d=await(0,oye.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,m7.toHex)(await f.digest()),h=[ac.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(h,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=y7(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,U2.toUint8Array)(e)),(0,m7.toHex)(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=(0,Wit.prepareRequest)(e),{longDate:c,shortDate:d}=y7(r),f=(0,g7.createScope)(d,u,a??this.service);l.headers[ac.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[ac.TOKEN_HEADER]=s.sessionToken);let p=await(0,oye.getPayloadHash)(l,this.sha256);!(0,zor.hasHeader)(ac.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[ac.SHA256_HEADER]=p);let h=(0,Vit.getCanonicalHeaders)(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[ac.AUTH_HEADER]=`${ac.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Jit(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,Uor.getCanonicalQuery)(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update((0,U2.toUint8Array)(n));let i=await o.digest();return`${ac.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,m7.toHex)(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return encodeURIComponent(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update((0,U2.toUint8Array)(i)),(0,m7.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,g7.getSigningKey)(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}};b7.SignatureV4=iye;var y7=t=>{let e=(0,Vor.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Jit=t=>Object.keys(t).sort().join(";")});var Yit=b(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.prepareRequest=Cf.moveHeadersToQuery=Cf.getPayloadHash=Cf.getCanonicalQuery=Cf.getCanonicalHeaders=void 0;var Kit=(QR(),ml(ZR));Kit.__exportStar(Git(),Cf);var Wor=Xge();Object.defineProperty(Cf,"getCanonicalHeaders",{enumerable:!0,get:function(){return Wor.getCanonicalHeaders}});var Jor=Qge();Object.defineProperty(Cf,"getCanonicalQuery",{enumerable:!0,get:function(){return Jor.getCanonicalQuery}});var Gor=eye();Object.defineProperty(Cf,"getPayloadHash",{enumerable:!0,get:function(){return Gor.getPayloadHash}});var Kor=rye();Object.defineProperty(Cf,"moveHeadersToQuery",{enumerable:!0,get:function(){return Kor.moveHeadersToQuery}});var Yor=nye();Object.defineProperty(Cf,"prepareRequest",{enumerable:!0,get:function(){return Yor.prepareRequest}});Kit.__exportStar(Kge(),Cf)});var Xit=b(aye=>{"use strict";Object.defineProperty(aye,"__esModule",{value:!0});var Xor=(QR(),ml(ZR));Xor.__exportStar(Yit(),aye)});var ha=b(($eo,Zit)=>{"use strict";Zit.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var kL=b((qeo,_7)=>{"use strict";var{AbortController:Qit,AbortSignal:Zor}=typeof self<"u"?self:typeof window<"u"?window:void 0;_7.exports=Qit;_7.exports.AbortSignal=Zor;_7.exports.default=Qit});var z2=b((Ueo,sye)=>{"use strict";var BL=typeof Reflect=="object"?Reflect:null,eat=BL&&typeof BL.apply=="function"?BL.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},v7;BL&&typeof BL.ownKeys=="function"?v7=BL.ownKeys:Object.getOwnPropertySymbols?v7=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:v7=function(e){return Object.getOwnPropertyNames(e)};function Qor(t){console&&console.warn&&console.warn(t)}var rat=Number.isNaN||function(e){return e!==e};function Wo(){Wo.init.call(this)}sye.exports=Wo;sye.exports.once=nir;Wo.EventEmitter=Wo;Wo.prototype._events=void 0;Wo.prototype._eventsCount=0;Wo.prototype._maxListeners=void 0;var tat=10;function w7(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Wo,"defaultMaxListeners",{enumerable:!0,get:function(){return tat},set:function(t){if(typeof t!="number"||t<0||rat(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");tat=t}});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(e){if(typeof e!="number"||e<0||rat(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function nat(t){return t._maxListeners===void 0?Wo.defaultMaxListeners:t._maxListeners}Wo.prototype.getMaxListeners=function(){return nat(this)};Wo.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=e==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(u===void 0)return!1;if(typeof u=="function")eat(u,this,r);else for(var l=u.length,c=uat(u,l),n=0;n<l;++n)eat(c[n],this,r);return!0};function oat(t,e,r,n){var o,i,a;if(w7(r),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),a=i[e]),a===void 0)a=i[e]=r,++t._eventsCount;else if(typeof a=="function"?a=i[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),o=nat(t),o>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,Qor(s)}return t}Wo.prototype.addListener=function(e,r){return oat(this,e,r,!1)};Wo.prototype.on=Wo.prototype.addListener;Wo.prototype.prependListener=function(e,r){return oat(this,e,r,!0)};function eir(){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 iat(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=eir.bind(n);return o.listener=r,n.wrapFn=o,o}Wo.prototype.once=function(e,r){return w7(r),this.on(e,iat(this,e,r)),this};Wo.prototype.prependOnceListener=function(e,r){return w7(r),this.prependListener(e,iat(this,e,r)),this};Wo.prototype.removeListener=function(e,r){var n,o,i,a,s;if(w7(r),o=this._events,o===void 0)return this;if(n=o[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===r||n[a].listener===r){s=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():tir(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Wo.prototype.off=Wo.prototype.removeListener;Wo.prototype.removeAllListeners=function(e){var r,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(o=0;o<i.length;++o)a=i[o],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(e,r[o]);return this};function aat(t,e,r){var n=t._events;if(n===void 0)return[];var o=n[e];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?rir(o):uat(o,o.length)}Wo.prototype.listeners=function(e){return aat(this,e,!0)};Wo.prototype.rawListeners=function(e){return aat(this,e,!1)};Wo.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):sat.call(t,e)};Wo.prototype.listenerCount=sat;function sat(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Wo.prototype.eventNames=function(){return this._eventsCount>0?v7(this._events):[]};function uat(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function tir(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function rir(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function nir(t,e){return new Promise(function(r,n){function o(a){t.removeListener(e,i),n(a)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",o),r([].slice.call(arguments))}lat(t,e,i,{once:!0}),e!=="error"&&oir(t,o,{once:!0})})}function oir(t,e,r){typeof t.on=="function"&&lat(t,"error",e,r)}function lat(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function o(i){n.once&&t.removeEventListener(e,o),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var rd=b((zeo,lye)=>{"use strict";var iir=hg(),{kResistStopPropagation:air,SymbolDispose:sir}=ha(),uir=globalThis.AbortSignal||kL().AbortSignal,lir=globalThis.AbortController||kL().AbortController,cir=Object.getPrototypeOf(async function(){}).constructor,cat=globalThis.Blob||iir.Blob,dir=typeof cat<"u"?function(e){return e instanceof cat}:function(e){return!1},dat=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},fir=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},uye=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
`;super(r),this.name="AggregateError",this.errors=e}};lye.exports={AggregateError:uye,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...o)=>n?r(n):e(...o))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let o=e.shift();return n==="f"?o.toFixed(6):n==="j"?JSON.stringify(o):n==="s"&&typeof o=="object"?`${o.constructor!==Object?o.constructor.name:""} {}`.trim():o.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof cir},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:dir,deprecate(t,e){return t},addAbortListener:z2().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);dat(e,"signal"),fir(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[air]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[sir](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:uir.any||function(e){if(e.length===1)return e[0];let r=new lir,n=()=>r.abort();return e.forEach(o=>{dat(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};lye.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var qd=b((Heo,hat)=>{"use strict";var{format:pir,inspect:S7,AggregateError:hir}=rd(),mir=globalThis.AggregateError||hir,gir=Symbol("kIsNodeError"),yir=["string","function","number","object","Function","Object","boolean","bigint","symbol"],bir=/^([A-Z][a-z0-9]*)+$/,_ir="__node_internal_",x7={};function oI(t,e){if(!t)throw new x7.ERR_INTERNAL_ASSERTION(e)}function fat(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function vir(t,e,r){if(typeof e=="function")return oI(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return oI(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:pir(e,...r)}function sc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(vir(t,e,i))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[gir]=!0,x7[t]=n}function pat(t){let e=_ir+t.name;return Object.defineProperty(t,"name",{value:e}),t}function wir(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new mir([e,t],e.message);return r.code=e.code,r}return t||e}var cye=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new x7.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};sc("ERR_ASSERTION","%s",Error);sc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{oI(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let o=[],i=[],a=[];for(let u of e)oI(typeof u=="string","All expected entries have to be of type string"),yir.includes(u)?o.push(u.toLowerCase()):bir.test(u)?i.push(u):(oI(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=S7(r,{depth:-1});n+=`. Received ${u}`}}else{let u=S7(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);sc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=S7(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);sc("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let o=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${o}.`},TypeError);sc("ERR_MISSING_ARGS",(...t)=>{oI(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);sc("ERR_OUT_OF_RANGE",(t,e,r)=>{oI(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=fat(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=fat(n)),n+="n"):n=S7(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);sc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);sc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);sc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);sc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);sc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);sc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);sc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);sc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);sc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);sc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);sc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);hat.exports={AbortError:cye,aggregateTwoErrors:pat(wir),hideStackFrames:pat,codes:x7}});var qL=b((Veo,Cat)=>{"use strict";var{ArrayIsArray:fye,ArrayPrototypeIncludes:bat,ArrayPrototypeJoin:_at,ArrayPrototypeMap:Sir,NumberIsInteger:pye,NumberIsNaN:xir,NumberMAX_SAFE_INTEGER:Cir,NumberMIN_SAFE_INTEGER:Oir,NumberParseInt:Eir,ObjectPrototypeHasOwnProperty:Pir,RegExpPrototypeExec:vat,String:Tir,StringPrototypeToUpperCase:Mir,StringPrototypeTrim:Air}=ha(),{hideStackFrames:Lh,codes:{ERR_SOCKET_BAD_PORT:Rir,ERR_INVALID_ARG_TYPE:nd,ERR_INVALID_ARG_VALUE:$L,ERR_OUT_OF_RANGE:iI,ERR_UNKNOWN_SIGNAL:mat}}=qd(),{normalizeEncoding:Iir}=rd(),{isAsyncFunction:Dir,isArrayBufferView:jir}=rd().types,gat={};function Nir(t){return t===(t|0)}function Lir(t){return t===t>>>0}var Fir=/^[0-7]+$/,kir="must be a 32-bit unsigned integer or an octal string";function Bir(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(vat(Fir,t)===null)throw new $L(e,t,kir);t=Eir(t,8)}return wat(t,e),t}var $ir=Lh((t,e,r=Oir,n=Cir)=>{if(typeof t!="number")throw new nd(e,"number",t);if(!pye(t))throw new iI(e,"an integer",t);if(t<r||t>n)throw new iI(e,`>= ${r} && <= ${n}`,t)}),qir=Lh((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new nd(e,"number",t);if(!pye(t))throw new iI(e,"an integer",t);if(t<r||t>n)throw new iI(e,`>= ${r} && <= ${n}`,t)}),wat=Lh((t,e,r=!1)=>{if(typeof t!="number")throw new nd(e,"number",t);if(!pye(t))throw new iI(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new iI(e,`>= ${n} && <= ${o}`,t)});function hye(t,e){if(typeof t!="string")throw new nd(e,"string",t)}function Uir(t,e,r=void 0,n){if(typeof t!="number")throw new nd(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&xir(t))throw new iI(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var zir=Lh((t,e,r)=>{if(!bat(r,t)){let o="must be one of: "+_at(Sir(r,i=>typeof i=="string"?`'${i}'`:Tir(i)),", ");throw new $L(e,t,o)}});function Sat(t,e){if(typeof t!="boolean")throw new nd(e,"boolean",t)}function dye(t,e,r){return t==null||!Pir(t,e)?r:t[e]}var Hir=Lh((t,e,r=null)=>{let n=dye(r,"allowArray",!1),o=dye(r,"allowFunction",!1);if(!dye(r,"nullable",!1)&&t===null||!n&&fye(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new nd(e,"Object",t)}),Vir=Lh((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new nd(e,"a dictionary",t)}),C7=Lh((t,e,r=0)=>{if(!fye(t))throw new nd(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new $L(e,t,n)}});function Wir(t,e){C7(t,e);for(let r=0;r<t.length;r++)hye(t[r],`${e}[${r}]`)}function Jir(t,e){C7(t,e);for(let r=0;r<t.length;r++)Sat(t[r],`${e}[${r}]`)}function Gir(t,e){C7(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new nd(o,"AbortSignal",n);xat(n,o)}}function Kir(t,e="signal"){if(hye(t,e),gat[t]===void 0)throw gat[Mir(t)]!==void 0?new mat(t+" (signals must use all capital letters)"):new mat(t)}var Yir=Lh((t,e="buffer")=>{if(!jir(t))throw new nd(e,["Buffer","TypedArray","DataView"],t)});function Xir(t,e){let r=Iir(e),n=t.length;if(r==="hex"&&n%2!==0)throw new $L("encoding",e,`is invalid for data of length ${n}`)}function Zir(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Air(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Rir(e,t,r);return t|0}var xat=Lh((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new nd(e,"AbortSignal",t)}),Qir=Lh((t,e)=>{if(typeof t!="function")throw new nd(e,"Function",t)}),ear=Lh((t,e)=>{if(typeof t!="function"||Dir(t))throw new nd(e,"Function",t)}),tar=Lh((t,e)=>{if(t!==void 0)throw new nd(e,"undefined",t)});function rar(t,e,r){if(!bat(r,t))throw new nd(e,`('${_at(r,"|")}')`,t)}var nar=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function yat(t,e){if(typeof t>"u"||!vat(nar,t))throw new $L(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oar(t){if(typeof t=="string")return yat(t,"hints"),t;if(fye(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];yat(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new $L("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Cat.exports={isInt32:Nir,isUint32:Lir,parseFileMode:Bir,validateArray:C7,validateStringArray:Wir,validateBooleanArray:Jir,validateAbortSignalArray:Gir,validateBoolean:Sat,validateBuffer:Yir,validateDictionary:Vir,validateEncoding:Xir,validateFunction:Qir,validateInt32:qir,validateInteger:$ir,validateNumber:Uir,validateObject:Hir,validateOneOf:zir,validatePlainFunction:ear,validatePort:Zir,validateSignalName:Kir,validateString:hye,validateUint32:wat,validateUndefined:tar,validateUnion:rar,validateAbortSignal:xat,validateLinkHeaderValue:oar}});var xP=b((Weo,Tat)=>{var as=Tat.exports={},bb,_b;function mye(){throw new Error("setTimeout has not been defined")}function gye(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?bb=setTimeout:bb=mye}catch{bb=mye}try{typeof clearTimeout=="function"?_b=clearTimeout:_b=gye}catch{_b=gye}})();function Oat(t){if(bb===setTimeout)return setTimeout(t,0);if((bb===mye||!bb)&&setTimeout)return bb=setTimeout,setTimeout(t,0);try{return bb(t,0)}catch{try{return bb.call(null,t,0)}catch{return bb.call(this,t,0)}}}function iar(t){if(_b===clearTimeout)return clearTimeout(t);if((_b===gye||!_b)&&clearTimeout)return _b=clearTimeout,clearTimeout(t);try{return _b(t)}catch{try{return _b.call(null,t)}catch{return _b.call(this,t)}}}var Ux=[],UL=!1,aI,O7=-1;function aar(){!UL||!aI||(UL=!1,aI.length?Ux=aI.concat(Ux):O7=-1,Ux.length&&Eat())}function Eat(){if(!UL){var t=Oat(aar);UL=!0;for(var e=Ux.length;e;){for(aI=Ux,Ux=[];++O7<e;)aI&&aI[O7].run();O7=-1,e=Ux.length}aI=null,UL=!1,iar(t)}}as.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ux.push(new Pat(t,e)),Ux.length===1&&!UL&&Oat(Eat)};function Pat(t,e){this.fun=t,this.array=e}Pat.prototype.run=function(){this.fun.apply(null,this.array)};as.title="browser";as.browser=!0;as.env={};as.argv=[];as.version="";as.versions={};function zx(){}as.on=zx;as.addListener=zx;as.once=zx;as.off=zx;as.removeListener=zx;as.removeAllListeners=zx;as.emit=zx;as.prependListener=zx;as.prependOnceListener=zx;as.listeners=function(t){return[]};as.binding=function(t){throw new Error("process.binding is not supported")};as.cwd=function(){return"/"};as.chdir=function(t){throw new Error("process.chdir is not supported")};as.umask=function(){return 0}});var wb=b((Jeo,zat)=>{"use strict";var{SymbolAsyncIterator:Mat,SymbolIterator:Aat,SymbolFor:sI}=ha(),Rat=sI("nodejs.stream.destroyed"),Iat=sI("nodejs.stream.errored"),yye=sI("nodejs.stream.readable"),bye=sI("nodejs.stream.writable"),Dat=sI("nodejs.stream.disturbed"),sar=sI("nodejs.webstream.isClosedPromise"),uar=sI("nodejs.webstream.controllerErrorFunction");function E7(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function P7(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function lar(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function vb(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function jat(t){return!!(t&&!vb(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Nat(t){return!!(t&&!vb(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Lat(t){return!!(t&&!vb(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function car(t){return jat(t)||Nat(t)||Lat(t)}function dar(t,e){return t==null?!1:e===!0?typeof t[Mat]=="function":e===!1?typeof t[Aat]=="function":typeof t[Mat]=="function"||typeof t[Aat]=="function"}function T7(t){if(!vb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Rat]||n!=null&&n.destroyed)}function Fat(t){if(!P7(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function far(t,e){if(!P7(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function par(t){if(!E7(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function kat(t,e){if(!E7(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Bat(t){return t&&t[yye]!=null?t[yye]:typeof t?.readable!="boolean"?null:T7(t)?!1:E7(t)&&t.readable&&!kat(t)}function $at(t){return t&&t[bye]!=null?t[bye]:typeof t?.writable!="boolean"?null:T7(t)?!1:P7(t)&&t.writable&&!Fat(t)}function har(t,e){return vb(t)?T7(t)?!0:!(e?.readable!==!1&&Bat(t)||e?.writable!==!1&&$at(t)):null}function mar(t){var e,r;return vb(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function gar(t){var e,r;return vb(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function yar(t){if(!vb(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&qat(t)?t._closed:null}function qat(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Uat(t){return typeof t._sent100=="boolean"&&qat(t)}function bar(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function _ar(t){if(!vb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Uat(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function war(t){var e;return!!(t&&((e=t[Dat])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Sar(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Iat])!==null&&a!==void 0?a:t.readableErrored)!==null&&i!==void 0?i:t.writableErrored)!==null&&o!==void 0?o:(s=t._readableState)===null||s===void 0?void 0:s.errorEmitted)!==null&&n!==void 0?n:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(l=t._readableState)===null||l===void 0?void 0:l.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}zat.exports={isDestroyed:T7,kIsDestroyed:Rat,isDisturbed:war,kIsDisturbed:Dat,isErrored:Sar,kIsErrored:Iat,isReadable:Bat,kIsReadable:yye,kIsClosedPromise:sar,kControllerErrorFunction:uar,kIsWritable:bye,isClosed:yar,isDuplexNodeStream:lar,isFinished:har,isIterable:dar,isReadableNodeStream:E7,isReadableStream:jat,isReadableEnded:par,isReadableFinished:kat,isReadableErrored:gar,isNodeStream:vb,isWebStream:car,isWritable:$at,isWritableNodeStream:P7,isWritableStream:Nat,isWritableEnded:Fat,isWritableFinished:far,isWritableErrored:mar,isServerRequest:bar,isServerResponse:Uat,willEmitClose:_ar,isTransformStream:Lat}});var Hx=b((Geo,xye)=>{var CP=xP(),{AbortError:Zat,codes:xar}=qd(),{ERR_INVALID_ARG_TYPE:Car,ERR_STREAM_PREMATURE_CLOSE:Hat}=xar,{kEmptyObject:vye,once:wye}=rd(),{validateAbortSignal:Oar,validateFunction:Ear,validateObject:Par,validateBoolean:Tar}=qL(),{Promise:Mar,PromisePrototypeThen:Aar,SymbolDispose:Qat}=ha(),{isClosed:Rar,isReadable:Vat,isReadableNodeStream:_ye,isReadableStream:Iar,isReadableFinished:Wat,isReadableErrored:Jat,isWritable:Gat,isWritableNodeStream:Kat,isWritableStream:Dar,isWritableFinished:Yat,isWritableErrored:Xat,isNodeStream:jar,willEmitClose:Nar,kIsClosedPromise:Lar}=wb(),zL;function Far(t){return t.setHeader&&typeof t.abort=="function"}var Sye=()=>{};function est(t,e,r){var n,o;if(arguments.length===2?(r=e,e=vye):e==null?e=vye:Par(e,"options"),Ear(r,"callback"),Oar(e.signal,"options.signal"),r=wye(r),Iar(t)||Dar(t))return kar(t,e,r);if(!jar(t))throw new Car("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:_ye(t),a=(o=e.writable)!==null&&o!==void 0?o:Kat(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=Nar(t)&&_ye(t)===i&&Kat(t)===a,d=Yat(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=Wat(t,!1),h=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},m=O=>{r.call(t,O)},v=Rar(t),g=()=>{v=!0;let O=Xat(t)||Jat(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&_ye(t,!0)&&!Wat(t,!1))return r.call(t,new Hat);if(a&&!d&&!Yat(t,!1))return r.call(t,new Hat);r.call(t)},_=()=>{v=!0;let O=Xat(t)||Jat(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},S=()=>{t.req.on("finish",f)};Far(t)?(t.on("complete",f),c||t.on("abort",g),t.req?S():t.on("request",S)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",h),t.on("finish",f),e.error!==!1&&t.on("error",m),t.on("close",g),v?CP.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||CP.nextTick(_):(!i&&(!c||Vat(t))&&(d||Gat(t)===!1)||!a&&(!c||Gat(t))&&(p||Vat(t)===!1)||u&&t.req&&t.aborted)&&CP.nextTick(_);let x=()=>{r=Sye,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",S),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",h),t.removeListener("error",m),t.removeListener("close",g)};if(e.signal&&!v){let O=()=>{let T=r;x(),T.call(t,new Zat(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)CP.nextTick(O);else{zL=zL||rd().addAbortListener;let T=zL(e.signal,O),E=r;r=wye((...M)=>{T[Qat](),E.apply(t,M)})}}return x}function kar(t,e,r){let n=!1,o=Sye;if(e.signal)if(o=()=>{n=!0,r.call(t,new Zat(void 0,{cause:e.signal.reason}))},e.signal.aborted)CP.nextTick(o);else{zL=zL||rd().addAbortListener;let a=zL(e.signal,o),s=r;r=wye((...u)=>{a[Qat](),s.apply(t,u)})}let i=(...a)=>{n||CP.nextTick(()=>r.apply(t,a))};return Aar(t[Lar].promise,i,i),Sye}function Bar(t,e){var r;let n=!1;return e===null&&(e=vye),(r=e)!==null&&r!==void 0&&r.cleanup&&(Tar(e.cleanup,"cleanup"),n=e.cleanup),new Mar((o,i)=>{let a=est(t,e,s=>{n&&a(),s?i(s):o()})})}xye.exports=est;xye.exports.finished=Bar});var uI=b((Keo,ust)=>{"use strict";var Sb=xP(),{aggregateTwoErrors:$ar,codes:{ERR_MULTIPLE_CALLBACK:qar},AbortError:Uar}=qd(),{Symbol:nst}=ha(),{kIsDestroyed:zar,isDestroyed:Har,isFinished:Var,isServerRequest:War}=wb(),ost=nst("kDestroy"),Cye=nst("kConstruct");function ist(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Jar(t,e){let r=this._readableState,n=this._writableState,o=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(ist(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?tst(this,t,e):this.once(ost,function(i){tst(this,$ar(i,t),e)}),this)}function tst(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;ist(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?Sb.nextTick(Gar,t,i):Sb.nextTick(ast,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function Gar(t,e){Oye(t,e),ast(t)}function ast(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Oye(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Kar(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Eye(t,e,r){let n=t._readableState,o=t._writableState;if(o!=null&&o.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||o!=null&&o.autoDestroy?t.destroy(e):e&&(e.stack,o&&!o.errored&&(o.errored=e),n&&!n.errored&&(n.errored=e),r?Sb.nextTick(Oye,t,e):Oye(t,e))}function Yar(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Cye,e),!(t.listenerCount(Cye)>1)&&Sb.nextTick(Xar,t)}function Xar(t){let e=!1;function r(n){if(e){Eye(t,n??new qar);return}e=!0;let o=t._readableState,i=t._writableState,a=i||o;o&&(o.constructed=!0),i&&(i.constructed=!0),a.destroyed?t.emit(ost,n):n?Eye(t,n,!0):Sb.nextTick(Zar,t)}try{t._construct(n=>{Sb.nextTick(r,n)})}catch(n){Sb.nextTick(r,n)}}function Zar(t){t.emit(Cye)}function rst(t){return t?.setHeader&&typeof t.abort=="function"}function sst(t){t.emit("close")}function Qar(t,e){t.emit("error",e),Sb.nextTick(sst,t)}function esr(t,e){!t||Har(t)||(!e&&!Var(t)&&(e=new Uar),War(t)?(t.socket=null,t.destroy(e)):rst(t)?t.abort():rst(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Sb.nextTick(Qar,t,e):Sb.nextTick(sst,t),t.destroyed||(t[zar]=!0))}ust.exports={construct:Yar,destroyer:esr,destroy:Jar,undestroy:Kar,errorOrDestroy:Eye}});var R7=b((Yeo,cst)=>{"use strict";var{ArrayIsArray:tsr,ObjectSetPrototypeOf:lst}=ha(),{EventEmitter:M7}=z2();function A7(t){M7.call(this,t)}lst(A7.prototype,M7.prototype);lst(A7,M7);A7.prototype.pipe=function(t,e){let r=this;function n(c){t.writable&&t.write(c)===!1&&r.pause&&r.pause()}r.on("data",n);function o(){r.readable&&r.resume&&r.resume()}t.on("drain",o),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",a),r.on("close",s));let i=!1;function a(){i||(i=!0,t.end())}function s(){i||(i=!0,typeof t.destroy=="function"&&t.destroy())}function u(c){l(),M7.listenerCount(this,"error")===0&&this.emit("error",c)}Pye(r,"error",u),Pye(t,"error",u);function l(){r.removeListener("data",n),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t};function Pye(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):tsr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}cst.exports={Stream:A7,prependListener:Pye}});var H2=b((Xeo,I7)=>{"use strict";var{SymbolDispose:rsr}=ha(),{AbortError:dst,codes:nsr}=qd(),{isNodeStream:fst,isWebStream:osr,kControllerErrorFunction:isr}=wb(),asr=Hx(),{ERR_INVALID_ARG_TYPE:pst}=nsr,Tye,ssr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new pst(e,"AbortSignal",t)};I7.exports.addAbortSignal=function(e,r){if(ssr(e,"signal"),!fst(r)&&!osr(r))throw new pst("stream",["ReadableStream","WritableStream","Stream"],r);return I7.exports.addAbortSignalNoValidate(e,r)};I7.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=fst(e)?()=>{e.destroy(new dst(void 0,{cause:t.reason}))}:()=>{e[isr](new dst(void 0,{cause:t.reason}))};if(t.aborted)r();else{Tye=Tye||rd().addAbortListener;let n=Tye(t,r);asr(e,n[rsr])}return e}});var gst=b((Qeo,mst)=>{"use strict";var{StringPrototypeSlice:hst,SymbolIterator:usr,TypedArrayPrototypeSet:D7,Uint8Array:lsr}=ha(),{Buffer:Mye}=hg(),{inspect:csr}=rd();mst.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Mye.alloc(0);let r=Mye.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)D7(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let o=n.slice(0,e);return this.head.data=n.slice(e),o}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[usr](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,o=0;do{let i=n.data;if(e>i.length)r+=i,e-=i.length;else{e===i.length?(r+=i,++o,n.next?this.head=n.next:this.head=this.tail=null):(r+=hst(i,0,e),this.head=n,n.data=hst(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=Mye.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)D7(r,a,n-e),e-=a.length;else{e===a.length?(D7(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(D7(r,new lsr(a.buffer,a.byteOffset,e),n-e),this.head=o,o.data=a.slice(e));break}++i}while((o=o.next)!==null);return this.length-=i,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return csr(this,{...r,depth:0,customInspect:!1})}}});var V2=b((eto,vst)=>{"use strict";var{MathFloor:dsr,NumberIsInteger:fsr}=ha(),{validateInteger:psr}=qL(),{ERR_INVALID_ARG_VALUE:hsr}=qd().codes,yst=16*1024,bst=16;function msr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function _st(t){return t?bst:yst}function gsr(t,e){psr(e,"value",0),t?bst=e:yst=e}function ysr(t,e,r,n){let o=msr(e,n,r);if(o!=null){if(!fsr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new hsr(i,o)}return dsr(o)}return _st(t.objectMode)}vst.exports={getHighWaterMark:ysr,getDefaultHighWaterMark:_st,setDefaultHighWaterMark:gsr}});var xst=b((Aye,Sst)=>{var j7=hg(),xb=j7.Buffer;function wst(t,e){for(var r in t)e[r]=t[r]}xb.from&&xb.alloc&&xb.allocUnsafe&&xb.allocUnsafeSlow?Sst.exports=j7:(wst(j7,Aye),Aye.Buffer=lI);function lI(t,e,r){return xb(t,e,r)}lI.prototype=Object.create(xb.prototype);wst(xb,lI);lI.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xb(t,e,r)};lI.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xb(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};lI.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xb(t)};lI.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return j7.SlowBuffer(t)}});var Est=b(Ost=>{"use strict";var Iye=xst().Buffer,Cst=Iye.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function bsr(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function _sr(t){var e=bsr(t);if(typeof e!="string"&&(Iye.isEncoding===Cst||!Cst(t)))throw new Error("Unknown encoding: "+t);return e||t}Ost.StringDecoder=W2;function W2(t){this.encoding=_sr(t);var e;switch(this.encoding){case"utf16le":this.text=Osr,this.end=Esr,e=4;break;case"utf8":this.fillLast=Ssr,e=4;break;case"base64":this.text=Psr,this.end=Tsr,e=3;break;default:this.write=Msr,this.end=Asr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Iye.allocUnsafe(e)}W2.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};W2.prototype.end=Csr;W2.prototype.text=xsr;W2.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function Rye(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function vsr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=Rye(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=Rye(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=Rye(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function wsr(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Ssr(t){var e=this.lastTotal-this.lastNeed,r=wsr(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function xsr(t,e){var r=vsr(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Csr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Osr(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Esr(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Psr(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Tsr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Msr(t){return t.toString(this.encoding)}function Asr(t){return t&&t.length?this.write(t):""}});var Dye=b((rto,Ast)=>{"use strict";var Pst=xP(),{PromisePrototypeThen:Rsr,SymbolAsyncIterator:Tst,SymbolIterator:Mst}=ha(),{Buffer:Isr}=hg(),{ERR_INVALID_ARG_TYPE:Dsr,ERR_STREAM_NULL_VALUES:jsr}=qd().codes;function Nsr(t,e,r){let n;if(typeof e=="string"||e instanceof Isr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[Tst])o=!0,n=e[Tst]();else if(e&&e[Mst])o=!1,n=e[Mst]();else throw new Dsr("iterable",["Iterable"],e);let i=new t({objectMode:!0,highWaterMark:1,...r}),a=!1;i._read=function(){a||(a=!0,u())},i._destroy=function(l,c){Rsr(s(l),()=>Pst.nextTick(c,l),d=>Pst.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 jsr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}Ast.exports=Nsr});var G2=b((nto,Gst)=>{var vg=xP(),{ArrayPrototypeIndexOf:Lsr,NumberIsInteger:Fsr,NumberIsNaN:ksr,NumberParseInt:Bsr,ObjectDefineProperties:qye,ObjectKeys:$sr,ObjectSetPrototypeOf:Dst,Promise:jst,SafeSet:qsr,SymbolAsyncDispose:Usr,SymbolAsyncIterator:zsr,Symbol:Hsr}=ha();Gst.exports=Lr;Lr.ReadableState=k7;var{EventEmitter:Vsr}=z2(),{Stream:OP,prependListener:Wsr}=R7(),{Buffer:jye}=hg(),{addAbortSignal:Jsr}=H2(),Nst=Hx(),sn=rd().debuglog("stream",t=>{sn=t}),Gsr=gst(),WL=uI(),{getHighWaterMark:Ksr,getDefaultHighWaterMark:Ysr}=V2(),{aggregateTwoErrors:Rst,codes:{ERR_INVALID_ARG_TYPE:Xsr,ERR_METHOD_NOT_IMPLEMENTED:Zsr,ERR_OUT_OF_RANGE:Qsr,ERR_STREAM_PUSH_AFTER_EOF:eur,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:tur},AbortError:rur}=qd(),{validateObject:nur}=qL(),cI=Hsr("kPaused"),{StringDecoder:Lst}=Est(),our=Dye();Dst(Lr.prototype,OP.prototype);Dst(Lr,OP);var Nye=()=>{},{errorOrDestroy:HL}=WL,VL=1<<0,iur=1<<1,Fst=1<<2,J2=1<<3,kst=1<<4,N7=1<<5,L7=1<<6,Bst=1<<7,aur=1<<8,sur=1<<9,uur=1<<10,Bye=1<<11,$ye=1<<12,lur=1<<13,cur=1<<14,dur=1<<15,$st=1<<16,fur=1<<17,pur=1<<18;function Qu(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}qye(k7.prototype,{objectMode:Qu(VL),ended:Qu(iur),endEmitted:Qu(Fst),reading:Qu(J2),constructed:Qu(kst),sync:Qu(N7),needReadable:Qu(L7),emittedReadable:Qu(Bst),readableListening:Qu(aur),resumeScheduled:Qu(sur),errorEmitted:Qu(uur),emitClose:Qu(Bye),autoDestroy:Qu($ye),destroyed:Qu(lur),closed:Qu(cur),closeEmitted:Qu(dur),multiAwaitDrain:Qu($st),readingMore:Qu(fur),dataEmitted:Qu(pur)});function k7(t,e,r){typeof r!="boolean"&&(r=e instanceof Cb()),this.state=Bye|$ye|kst|N7,t&&t.objectMode&&(this.state|=VL),r&&t&&t.readableObjectMode&&(this.state|=VL),this.highWaterMark=t?Ksr(this,t,"readableHighWaterMark",r):Ysr(!1),this.buffer=new Gsr,this.length=0,this.pipes=[],this.flowing=null,this[cI]=null,t&&t.emitClose===!1&&(this.state&=~Bye),t&&t.autoDestroy===!1&&(this.state&=~$ye),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Lst(t.encoding),this.encoding=t.encoding)}function Lr(t){if(!(this instanceof Lr))return new Lr(t);let e=this instanceof Cb();this._readableState=new k7(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Jsr(t.signal,this)),OP.call(this,t),WL.construct(this,()=>{this._readableState.needReadable&&F7(this,this._readableState)})}Lr.prototype.destroy=WL.destroy;Lr.prototype._undestroy=WL.undestroy;Lr.prototype._destroy=function(t,e){e(t)};Lr.prototype[Vsr.captureRejectionSymbol]=function(t){this.destroy(t)};Lr.prototype[Usr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new rur,this.destroy(t)),new jst((e,r)=>Nst(this,n=>n&&n!==t?r(n):e(null)))};Lr.prototype.push=function(t,e){return qst(this,t,e,!1)};Lr.prototype.unshift=function(t,e){return qst(this,t,e,!0)};function qst(t,e,r,n){sn("readableAddChunk",e);let o=t._readableState,i;if(o.state&VL||(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=jye.from(e,r).toString(o.encoding):(e=jye.from(e,r),r=""))):e instanceof jye?r="":OP._isUint8Array(e)?(e=OP._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new Xsr("chunk",["string","Buffer","Uint8Array"],e))),i)HL(t,i);else if(e===null)o.state&=~J2,gur(t,o);else if(o.state&VL||e&&e.length>0)if(n)if(o.state&Fst)HL(t,new tur);else{if(o.destroyed||o.errored)return!1;Lye(t,o,e,!0)}else if(o.ended)HL(t,new eur);else{if(o.destroyed||o.errored)return!1;o.state&=~J2,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?Lye(t,o,e,!1):F7(t,o)):Lye(t,o,e,!1)}else n||(o.state&=~J2,F7(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function Lye(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&$st?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.state&L7&&B7(t)),F7(t,e)}Lr.prototype.isPaused=function(){let t=this._readableState;return t[cI]===!0||t.flowing===!1};Lr.prototype.setEncoding=function(t){let e=new Lst(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let o of r)n+=e.write(o);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var hur=1073741824;function mur(t){if(t>hur)throw new Qsr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ist(t,e){return t<=0||e.length===0&&e.ended?0:e.state&VL?1:ksr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}Lr.prototype.read=function(t){sn("read",t),t===void 0?t=NaN:Fsr(t)||(t=Bsr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=mur(t)),t!==0&&(e.state&=~Bst),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return sn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Fye(this):B7(this),null;if(t=Ist(t,e),t===0&&e.ended)return e.length===0&&Fye(this),null;let n=(e.state&L7)!==0;if(sn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,sn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,sn("reading, ended or constructing",n);else if(n){sn("do read"),e.state|=J2|N7,e.length===0&&(e.state|=L7);try{this._read(e.highWaterMark)}catch(i){HL(this,i)}e.state&=~N7,e.reading||(t=Ist(r,e))}let o;return t>0?o=Wst(t,e):o=null,o===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Fye(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function gur(t,e){if(sn("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?B7(t):(e.needReadable=!1,e.emittedReadable=!0,Ust(t))}}function B7(t){let e=t._readableState;sn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(sn("emitReadable",e.flowing),e.emittedReadable=!0,vg.nextTick(Ust,t))}function Ust(t){let e=t._readableState;sn("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Hst(t)}function F7(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,vg.nextTick(yur,t,e))}function yur(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(sn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Lr.prototype._read=function(t){throw new Zsr("_read()")};Lr.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new qsr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),sn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==vg.stdout&&t!==vg.stderr?s:v;n.endEmitted?vg.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,_){sn("onunpipe"),g===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){sn("onend"),t.end()}let u,l=!1;function c(){sn("cleanup"),t.removeListener("close",h),t.removeListener("finish",m),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),l=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function d(){l||(n.pipes.length===1&&n.pipes[0]===t?(sn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(sn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=bur(r,t),t.on("drain",u))}r.on("data",f);function f(g){sn("ondata");let _=t.write(g);sn("dest.write",_),_===!1&&d()}function p(g){if(sn("onerror",g),v(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?HL(t,g):t.emit("error",g)}}Wsr(t,"error",p);function h(){t.removeListener("finish",m),v()}t.once("close",h);function m(){sn("onfinish"),t.removeListener("close",h),v()}t.once("finish",m);function v(){sn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(sn("pipe resume"),r.resume()),t};function bur(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(sn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(sn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}Lr.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let o=e.pipes;e.pipes=[],this.pause();for(let i=0;i<o.length;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}let n=Lsr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Lr.prototype.on=function(t,e){let r=OP.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,sn("on readable",n.length,n.reading),n.length?B7(this):n.reading||vg.nextTick(_ur,this)),r};Lr.prototype.addListener=Lr.prototype.on;Lr.prototype.removeListener=function(t,e){let r=OP.prototype.removeListener.call(this,t,e);return t==="readable"&&vg.nextTick(zst,this),r};Lr.prototype.off=Lr.prototype.removeListener;Lr.prototype.removeAllListeners=function(t){let e=OP.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&vg.nextTick(zst,this),e};function zst(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[cI]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function _ur(t){sn("readable nexttick read 0"),t.read(0)}Lr.prototype.resume=function(){let t=this._readableState;return t.flowing||(sn("resume"),t.flowing=!t.readableListening,vur(this,t)),t[cI]=!1,this};function vur(t,e){e.resumeScheduled||(e.resumeScheduled=!0,vg.nextTick(wur,t,e))}function wur(t,e){sn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Hst(t),e.flowing&&!e.reading&&t.read(0)}Lr.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[cI]=!0,this};function Hst(t){let e=t._readableState;for(sn("flow",e.flowing);e.flowing&&t.read()!==null;);}Lr.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{HL(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=$sr(t);for(let n=1;n<r.length;n++){let o=r[n];this[o]===void 0&&typeof t[o]=="function"&&(this[o]=t[o].bind(t))}return this};Lr.prototype[zsr]=function(){return Vst(this)};Lr.prototype.iterator=function(t){return t!==void 0&&nur(t,"options"),Vst(this,t)};function Vst(t,e){typeof t.read!="function"&&(t=Lr.wrap(t,{objectMode:!0}));let r=Sur(t,e);return r.stream=t,r}async function*Sur(t,e){let r=Nye;function n(a){this===t?(r(),r=Nye):r=a}t.on("readable",n);let o,i=Nst(t,{writable:!1},a=>{o=a?Rst(o,a):null,r(),r=Nye});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(o)throw o;if(o===null)return;await new jst(n)}}}catch(a){throw o=Rst(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?WL.destroyer(t,null):(t.off("readable",n),i())}}qye(Lr.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});qye(k7.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[cI]!==!1},set(t){this[cI]=!!t}}});Lr._fromList=Wst;function Wst(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Fye(t){let e=t._readableState;sn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,vg.nextTick(xur,e,t))}function xur(t,e){if(sn("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)vg.nextTick(Cur,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Cur(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}Lr.from=function(t,e){return our(Lr,t,e)};var kye;function Jst(){return kye===void 0&&(kye={}),kye}Lr.fromWeb=function(t,e){return Jst().newStreamReadableFromReadableStream(t,e)};Lr.toWeb=function(t,e){return Jst().newReadableStreamFromStreamReadable(t,e)};Lr.wrap=function(t,e){var r,n;return new Lr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){WL.destroyer(t,o),i(o)}}).wrap(t)}});var H7=b((oto,aut)=>{var dI=xP(),{ArrayPrototypeSlice:Xst,Error:Our,FunctionPrototypeSymbolHasInstance:Zst,ObjectDefineProperty:Qst,ObjectDefineProperties:Eur,ObjectSetPrototypeOf:eut,StringPrototypeToLowerCase:Pur,Symbol:Tur,SymbolHasInstance:Mur}=ha();aut.exports=ma;ma.WritableState=X2;var{EventEmitter:Aur}=z2(),K2=R7().Stream,{Buffer:$7}=hg(),z7=uI(),{addAbortSignal:Rur}=H2(),{getHighWaterMark:Iur,getDefaultHighWaterMark:Dur}=V2(),{ERR_INVALID_ARG_TYPE:jur,ERR_METHOD_NOT_IMPLEMENTED:Nur,ERR_MULTIPLE_CALLBACK:tut,ERR_STREAM_CANNOT_PIPE:Lur,ERR_STREAM_DESTROYED:Y2,ERR_STREAM_ALREADY_FINISHED:Fur,ERR_STREAM_NULL_VALUES:kur,ERR_STREAM_WRITE_AFTER_END:Bur,ERR_UNKNOWN_ENCODING:rut}=qd().codes,{errorOrDestroy:JL}=z7;eut(ma.prototype,K2.prototype);eut(ma,K2);function Hye(){}var GL=Tur("kOnFinished");function X2(t,e,r){typeof r!="boolean"&&(r=e instanceof Cb()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Iur(this,t,"writableHighWaterMark",r):Dur(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=qur.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,U7(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[GL]=[]}function U7(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}X2.prototype.getBuffer=function(){return Xst(this.buffered,this.bufferedIndex)};Qst(X2.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ma(t){let e=this instanceof Cb();if(!e&&!Zst(ma,this))return new ma(t);this._writableState=new X2(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Rur(t.signal,this)),K2.call(this,t),z7.construct(this,()=>{let r=this._writableState;r.writing||Wye(this,r),Jye(this,r)})}Qst(ma,Mur,{__proto__:null,value:function(t){return Zst(this,t)?!0:this!==ma?!1:t&&t._writableState instanceof X2}});ma.prototype.pipe=function(){JL(this,new Lur)};function nut(t,e,r,n){let o=t._writableState;if(typeof r=="function")n=r,r=o.defaultEncoding;else{if(!r)r=o.defaultEncoding;else if(r!=="buffer"&&!$7.isEncoding(r))throw new rut(r);typeof n!="function"&&(n=Hye)}if(e===null)throw new kur;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=$7.from(e,r),r="buffer");else if(e instanceof $7)r="buffer";else if(K2._isUint8Array(e))e=K2._uint8ArrayToBuffer(e),r="buffer";else throw new jur("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new Bur:o.destroyed&&(i=new Y2("write")),i?(dI.nextTick(n,i),JL(t,i,!0),i):(o.pendingcb++,$ur(t,o,e,r,n))}ma.prototype.write=function(t,e,r){return nut(this,t,e,r)===!0};ma.prototype.cork=function(){this._writableState.corked++};ma.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Wye(this,t))};ma.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Pur(e)),!$7.isEncoding(e))throw new rut(e);return this._writableState.defaultEncoding=e,this};function $ur(t,e,r,n,o){let i=e.objectMode?1:r.length;e.length+=i;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:o}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&o!==Hye&&(e.allNoop=!1)):(e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}function Kst(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Y2("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function Yst(t,e,r,n){--e.pendingcb,n(r),Vye(e),JL(t,r)}function qur(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){JL(t,new tut);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?dI.nextTick(Yst,t,r,e,o):Yst(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&Wye(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},dI.nextTick(Uur,r.afterWriteTickInfo)):out(t,r,1,o))}function Uur({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,out(t,e,r,n)}function out(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Vye(e),Jye(t,e)}function Vye(t){if(t.writing)return;for(let o=t.bufferedIndex;o<t.buffered.length;++o){var e;let{chunk:i,callback:a}=t.buffered[o],s=t.objectMode?1:i.length;t.length-=s,a((e=t.errored)!==null&&e!==void 0?e:new Y2("write"))}let r=t[GL].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new Y2("end"))}U7(t)}function Wye(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:o}=e,i=r.length-n;if(!i)return;let a=n;if(e.bufferProcessing=!0,i>1&&t._writev){e.pendingcb-=i-1;let s=e.allNoop?Hye:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:Xst(r,a);u.allBuffers=e.allBuffers,Kst(t,e,!0,e.length,u,"",s),U7(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;Kst(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?U7(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}ma.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Nur("_write()")};ma.prototype._writev=null;ma.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let o;if(t!=null){let i=nut(this,t,e);i instanceof Our&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,Jye(this,n,!0),n.ended=!0):n.finished?o=new Fur("end"):n.destroyed&&(o=new Y2("end"))),typeof r=="function"&&(o||n.finished?dI.nextTick(r,o):n[GL].push(r)),this};function q7(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function zur(t,e){let r=!1;function n(o){if(r){JL(t,o??tut());return}if(r=!0,e.pendingcb--,o){let i=e[GL].splice(0);for(let a=0;a<i.length;a++)i[a](o);JL(t,o,e.sync)}else q7(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,dI.nextTick(zye,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function Hur(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,zur(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Jye(t,e,r){q7(e)&&(Hur(t,e),e.pendingcb===0&&(r?(e.pendingcb++,dI.nextTick((n,o)=>{q7(o)?zye(n,o):o.pendingcb--},t,e)):q7(e)&&(e.pendingcb++,zye(t,e))))}function zye(t,e){e.pendingcb--,e.finished=!0;let r=e[GL].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}Eur(ma.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Vur=z7.destroy;ma.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[GL].length)&&dI.nextTick(Vye,r),Vur.call(this,t,e),this};ma.prototype._undestroy=z7.undestroy;ma.prototype._destroy=function(t,e){e(t)};ma.prototype[Aur.captureRejectionSymbol]=function(t){this.destroy(t)};var Uye;function iut(){return Uye===void 0&&(Uye={}),Uye}ma.fromWeb=function(t,e){return iut().newStreamWritableFromWritableStream(t,e)};ma.toWeb=function(t){return iut().newWritableStreamFromStreamWritable(t)}});var wut=b((ito,vut)=>{var Gye=xP(),Wur=hg(),{isReadable:Jur,isWritable:Gur,isIterable:sut,isNodeStream:Kur,isReadableNodeStream:uut,isWritableNodeStream:lut,isDuplexNodeStream:Yur,isReadableStream:cut,isWritableStream:dut}=wb(),fut=Hx(),{AbortError:but,codes:{ERR_INVALID_ARG_TYPE:Xur,ERR_INVALID_RETURN_VALUE:put}}=qd(),{destroyer:YL}=uI(),Zur=Cb(),_ut=G2(),Qur=H7(),{createDeferredPromise:hut}=rd(),mut=Dye(),gut=globalThis.Blob||Wur.Blob,elr=typeof gut<"u"?function(e){return e instanceof gut}:function(e){return!1},tlr=globalThis.AbortController||kL().AbortController,{FunctionPrototypeCall:yut}=ha(),EP=class extends Zur{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};vut.exports=function t(e,r){if(Yur(e))return e;if(uut(e))return KL({readable:e});if(lut(e))return KL({writable:e});if(Kur(e))return KL({writable:!1,readable:!1});if(cut(e))return KL({readable:_ut.fromWeb(e)});if(dut(e))return KL({writable:Qur.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=rlr(e);if(sut(o))return mut(EP,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=yut(u,o,d=>{if(d!=null)throw new put("nully","body",d)},d=>{YL(l,d)});return l=new EP({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,Gye.nextTick(d,null)}catch(f){Gye.nextTick(d,f)}})},destroy:s})}throw new put("Iterable, AsyncIterable or AsyncFunction",r,o)}if(elr(e))return t(e.arrayBuffer());if(sut(e))return mut(EP,e,{objectMode:!0,writable:!1});if(cut(e?.readable)&&dut(e?.writable))return EP.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?uut(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?lut(e?.writable)?e?.writable:t(e.writable):void 0;return KL({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return yut(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{YL(o,i)}),o=new EP({objectMode:!0,writable:!1,read(){}})}throw new Xur(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function rlr(t){let{promise:e,resolve:r}=hut(),n=new tlr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(Gye.nextTick(l),u)return;if(o.aborted)throw new but(void 0,{cause:o.reason});({promise:e,resolve:r}=hut()),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 KL(t){let e=t.readable&&typeof t.readable.read!="function"?_ut.wrap(t.readable):t.readable,r=t.writable,n=!!Jur(e),o=!!Gur(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new EP({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(fut(r,d=>{o=!1,d&&YL(e,d),c(d)}),l._write=function(d,f,p){r.write(d,f)?p():i=p},l._final=function(d){r.end(),a=d},r.on("drain",function(){if(i){let d=i;i=null,d()}}),r.on("finish",function(){if(a){let d=a;a=null,d()}})),n&&(fut(e,d=>{n=!1,d&&YL(e,d),c(d)}),e.on("readable",function(){if(s){let d=s;s=null,d()}}),e.on("end",function(){l.push(null)}),l._read=function(){for(;;){let d=e.read();if(d===null){s=l._read;return}if(!l.push(d))return}}),l._destroy=function(d,f){!d&&u!==null&&(d=new but),s=null,i=null,a=null,u===null?f(d):(u=f,YL(r,d),YL(e,d))},l}});var Cb=b((ato,Cut)=>{"use strict";var{ObjectDefineProperties:nlr,ObjectGetOwnPropertyDescriptor:Vx,ObjectKeys:olr,ObjectSetPrototypeOf:Sut}=ha();Cut.exports=wg;var Xye=G2(),Fh=H7();Sut(wg.prototype,Xye.prototype);Sut(wg,Xye);{let t=olr(Fh.prototype);for(let e=0;e<t.length;e++){let r=t[e];wg.prototype[r]||(wg.prototype[r]=Fh.prototype[r])}}function wg(t){if(!(this instanceof wg))return new wg(t);Xye.call(this,t),Fh.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}nlr(wg.prototype,{writable:{__proto__:null,...Vx(Fh.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Vx(Fh.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Vx(Fh.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Vx(Fh.prototype,"writableBuffer")},writableLength:{__proto__:null,...Vx(Fh.prototype,"writableLength")},writableFinished:{__proto__:null,...Vx(Fh.prototype,"writableFinished")},writableCorked:{__proto__:null,...Vx(Fh.prototype,"writableCorked")},writableEnded:{__proto__:null,...Vx(Fh.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Vx(Fh.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Kye;function xut(){return Kye===void 0&&(Kye={}),Kye}wg.fromWeb=function(t,e){return xut().newStreamDuplexFromReadableWritablePair(t,e)};wg.toWeb=function(t){return xut().newReadableWritablePairFromDuplex(t)};var Yye;wg.from=function(t){return Yye||(Yye=wut()),Yye(t,"body")}});var ebe=b((sto,Eut)=>{"use strict";var{ObjectSetPrototypeOf:Out,Symbol:ilr}=ha();Eut.exports=Wx;var{ERR_METHOD_NOT_IMPLEMENTED:alr}=qd().codes,Qye=Cb(),{getHighWaterMark:slr}=V2();Out(Wx.prototype,Qye.prototype);Out(Wx,Qye);var Z2=ilr("kCallback");function Wx(t){if(!(this instanceof Wx))return new Wx(t);let e=t?slr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Qye.call(this,t),this._readableState.sync=!1,this[Z2]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",ulr)}function Zye(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function ulr(){this._final!==Zye&&Zye.call(this)}Wx.prototype._final=Zye;Wx.prototype._transform=function(t,e,r){throw new alr("_transform()")};Wx.prototype._write=function(t,e,r){let n=this._readableState,o=this._writableState,i=n.length;this._transform(t,e,(a,s)=>{if(a){r(a);return}s!=null&&this.push(s),o.ended||i===n.length||n.length<n.highWaterMark?r():this[Z2]=r})};Wx.prototype._read=function(){if(this[Z2]){let t=this[Z2];this[Z2]=null,t()}}});var rbe=b((uto,Tut)=>{"use strict";var{ObjectSetPrototypeOf:Put}=ha();Tut.exports=XL;var tbe=ebe();Put(XL.prototype,tbe.prototype);Put(XL,tbe);function XL(t){if(!(this instanceof XL))return new XL(t);tbe.call(this,t)}XL.prototype._transform=function(t,e,r){r(null,t)}});var G7=b((lto,Dut)=>{var Q2=xP(),{ArrayIsArray:llr,Promise:clr,SymbolAsyncIterator:dlr,SymbolDispose:flr}=ha(),J7=Hx(),{once:plr}=rd(),hlr=uI(),Mut=Cb(),{aggregateTwoErrors:mlr,codes:{ERR_INVALID_ARG_TYPE:dbe,ERR_INVALID_RETURN_VALUE:nbe,ERR_MISSING_ARGS:glr,ERR_STREAM_DESTROYED:ylr,ERR_STREAM_PREMATURE_CLOSE:blr},AbortError:_lr}=qd(),{validateFunction:vlr,validateAbortSignal:wlr}=qL(),{isIterable:fI,isReadable:obe,isReadableNodeStream:W7,isNodeStream:Aut,isTransformStream:ZL,isWebStream:Slr,isReadableStream:ibe,isReadableFinished:xlr}=wb(),Clr=globalThis.AbortController||kL().AbortController,abe,sbe,ube;function Rut(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=J7(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,hlr.destroyer(t,i||new ylr("pipe")))},cleanup:o}}function Olr(t){return vlr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function lbe(t){if(fI(t))return t;if(W7(t))return Elr(t);throw new dbe("val",["Readable","Iterable","AsyncIterable"],t)}async function*Elr(t){sbe||(sbe=G2()),yield*sbe.prototype[dlr].call(t)}async function V7(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new clr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=J7(e,{readable:!1},a);try{e.writableNeedDrain&&await s();for await(let l of t)e.write(l)||await s();n&&(e.end(),await s()),r()}catch(l){r(o!==l?mlr(o,l):l)}finally{u(),e.off("drain",a)}}async function cbe(t,e,r,{end:n}){ZL(e)&&(e=e.writable);let o=e.getWriter();try{for await(let i of t)await o.ready,o.write(i).catch(()=>{});await o.ready,n&&await o.close(),r()}catch(i){try{await o.abort(i),r(i)}catch(a){r(a)}}}function Plr(...t){return Iut(t,plr(Olr(t)))}function Iut(t,e,r){if(t.length===1&&llr(t[0])&&(t=t[0]),t.length<2)throw new glr("streams");let n=new Clr,o=n.signal,i=r?.signal,a=[];wlr(i,"options.signal");function s(){h(new _lr)}ube=ube||rd().addAbortListener;let u;i&&(u=ube(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[flr](),n.abort(),x&&(l||a.forEach(T=>T()),Q2.nextTick(e,l,c))}}let m;for(let S=0;S<t.length;S++){let x=t[S],O=S<t.length-1,T=S>0,E=O||r?.end!==!1,M=S===t.length-1;if(Aut(x)){let R=function(N){N&&N.name!=="AbortError"&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(N)};var _=R;if(E){let{destroy:N,cleanup:j}=Rut(x,O,T);d.push(N),obe(x)&&M&&a.push(j)}x.on("error",R),obe(x)&&M&&a.push(()=>{x.removeListener("error",R)})}if(S===0)if(typeof x=="function"){if(m=x({signal:o}),!fI(m))throw new nbe("Iterable, AsyncIterable or Stream","source",m)}else fI(x)||W7(x)||ZL(x)?m=x:m=Mut.from(x);else if(typeof x=="function"){if(ZL(m)){var v;m=lbe((v=m)===null||v===void 0?void 0:v.readable)}else m=lbe(m);if(m=x(m,{signal:o}),O){if(!fI(m,!0))throw new nbe("AsyncIterable",`transform[${S-1}]`,m)}else{var g;abe||(abe=rbe());let R=new abe({objectMode:!0}),N=(g=m)===null||g===void 0?void 0:g.then;if(typeof N=="function")f++,N.call(m,F=>{c=F,F!=null&&R.write(F),E&&R.end(),Q2.nextTick(p)},F=>{R.destroy(F),Q2.nextTick(p,F)});else if(fI(m,!0))f++,V7(m,R,p,{end:E});else if(ibe(m)||ZL(m)){let F=m.readable||m;f++,V7(F,R,p,{end:E})}else throw new nbe("AsyncIterable or Promise","destination",m);m=R;let{destroy:j,cleanup:k}=Rut(m,!1,!0);d.push(j),M&&a.push(k)}}else if(Aut(x)){if(W7(m)){f+=2;let R=Tlr(m,x,p,{end:E});obe(x)&&M&&a.push(R)}else if(ZL(m)||ibe(m)){let R=m.readable||m;f++,V7(R,x,p,{end:E})}else if(fI(m))f++,V7(m,x,p,{end:E});else throw new dbe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=x}else if(Slr(x)){if(W7(m))f++,cbe(lbe(m),x,p,{end:E});else if(ibe(m)||fI(m))f++,cbe(m,x,p,{end:E});else if(ZL(m))f++,cbe(m.readable,x,p,{end:E});else throw new dbe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=x}else m=Mut.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&Q2.nextTick(s),m}function Tlr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new blr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;xlr(t)?Q2.nextTick(a):t.once("end",a)}else r();return J7(t,{readable:!0,writable:!1},a=>{let s=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&s&&s.ended&&!s.errored&&!s.errorEmitted?t.once("end",r).once("error",r):r(a)}),J7(e,{readable:!1,writable:!0},r)}Dut.exports={pipelineImpl:Iut,pipeline:Plr}});var pbe=b((cto,But)=>{"use strict";var{pipeline:Mlr}=G7(),K7=Cb(),{destroyer:Alr}=uI(),{isNodeStream:Y7,isReadable:jut,isWritable:Nut,isWebStream:fbe,isTransformStream:pI,isWritableStream:Lut,isReadableStream:Fut}=wb(),{AbortError:Rlr,codes:{ERR_INVALID_ARG_VALUE:kut,ERR_MISSING_ARGS:Ilr}}=qd(),Dlr=Hx();But.exports=function(...e){if(e.length===0)throw new Ilr("streams");if(e.length===1)return K7.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=K7.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=K7.from(e[p])}for(let p=0;p<e.length;++p)if(!(!Y7(e[p])&&!fbe(e[p]))){if(p<e.length-1&&!(jut(e[p])||Fut(e[p])||pI(e[p])))throw new kut(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Nut(e[p])||Lut(e[p])||pI(e[p])))throw new kut(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let h=a;a=null,h?h(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=Mlr(e,u),d=!!(Nut(l)||Lut(l)||pI(l)),f=!!(jut(c)||Fut(c)||pI(c));if(s=new K7({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(Y7(l))s._write=function(h,m,v){l.write(h,m)?v():n=v},s._final=function(h){l.end(),o=h},l.on("drain",function(){if(n){let h=n;n=null,h()}});else if(fbe(l)){let m=(pI(l)?l.writable:l).getWriter();s._write=async function(v,g,_){try{await m.ready,m.write(v).catch(()=>{}),_()}catch(S){_(S)}},s._final=async function(v){try{await m.ready,m.close().catch(()=>{}),o=v}catch(g){v(g)}}}let p=pI(c)?c.readable:c;Dlr(p,()=>{if(o){let h=o;o=null,h()}})}if(f){if(Y7(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(fbe(c)){let h=(pI(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:m,done:v}=await h.read();if(!s.push(m))return;if(v){s.push(null);return}}catch{return}}}}return s._destroy=function(p,h){!p&&a!==null&&(p=new Rlr),i=null,n=null,o=null,a===null?h(p):(a=h,Y7(c)&&Alr(c,p))},s}});var Kut=b((dto,gbe)=>{"use strict";var jlr=globalThis.AbortController||kL().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Nlr,ERR_INVALID_ARG_TYPE:e4,ERR_MISSING_ARGS:Llr,ERR_OUT_OF_RANGE:Flr},AbortError:Ob}=qd(),{validateAbortSignal:hI,validateInteger:$ut,validateObject:mI}=qL(),klr=ha().Symbol("kWeak"),Blr=ha().Symbol("kResistStopPropagation"),{finished:$lr}=Hx(),qlr=pbe(),{addAbortSignalNoValidate:Ulr}=H2(),{isWritable:zlr,isNodeStream:Hlr}=wb(),{deprecate:Vlr}=rd(),{ArrayPrototypePush:Wlr,Boolean:Jlr,MathFloor:qut,Number:Glr,NumberIsNaN:Klr,Promise:Uut,PromiseReject:zut,PromiseResolve:Ylr,PromisePrototypeThen:Hut,Symbol:Wut}=ha(),X7=Wut("kEmpty"),Vut=Wut("kEof");function Xlr(t,e){if(e!=null&&mI(e,"options"),e?.signal!=null&&hI(e.signal,"options.signal"),Hlr(t)&&!zlr(t))throw new Nlr("stream",t,"must be writable");let r=qlr(this,t);return e!=null&&e.signal&&Ulr(e.signal,r),r}function Z7(t,e){if(typeof t!="function")throw new e4("fn",["Function","AsyncFunction"],t);e!=null&&mI(e,"options"),e?.signal!=null&&hI(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qut(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qut(e.highWaterMark)),$ut(r,"options.concurrency",1),$ut(n,"options.highWaterMark",0),n+=r,async function*(){let i=rd().AbortSignalAny([e?.signal].filter(Jlr)),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 v(){try{for await(let g of a){if(d)return;if(i.aborted)throw new Ob;try{if(g=t(g,u),g===X7)continue;g=Ylr(g)}catch(_){g=zut(_)}f+=1,Hut(g,h,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new Uut(_=>{c=_})}s.push(Vut)}catch(g){let _=zut(g);Hut(_,h,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}v();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===Vut)return;if(i.aborted)throw new Ob;g!==X7&&(yield g),s.shift(),m()}await new Uut(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function Zlr(t=void 0){return t!=null&&mI(t,"options"),t?.signal!=null&&hI(t.signal,"options.signal"),async function*(){let r=0;for await(let o of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ob({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Jut(t,e=void 0){for await(let r of mbe.call(this,t,e))return!0;return!1}async function Qlr(t,e=void 0){if(typeof t!="function")throw new e4("fn",["Function","AsyncFunction"],t);return!await Jut.call(this,async(...r)=>!await t(...r),e)}async function ecr(t,e){for await(let r of mbe.call(this,t,e))return r}async function tcr(t,e){if(typeof t!="function")throw new e4("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),X7}for await(let n of Z7.call(this,r,e));}function mbe(t,e){if(typeof t!="function")throw new e4("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:X7}return Z7.call(this,r,e)}var hbe=class extends Llr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function rcr(t,e,r){var n;if(typeof t!="function")throw new e4("reducer",["Function","AsyncFunction"],t);r!=null&&mI(r,"options"),r?.signal!=null&&hI(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new Ob(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await $lr(this.destroy(l)),l}let i=new jlr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[klr]:this,[Blr]:!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 Ob;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new hbe}finally{i.abort()}return e}async function ncr(t){t!=null&&mI(t,"options"),t?.signal!=null&&hI(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ob(void 0,{cause:t.signal.reason});Wlr(e,n)}return e}function ocr(t,e){let r=Z7.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function Gut(t){if(t=Glr(t),Klr(t))return 0;if(t<0)throw new Flr("number",">= 0",t);return t}function icr(t,e=void 0){return e!=null&&mI(e,"options"),e?.signal!=null&&hI(e.signal,"options.signal"),t=Gut(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ob;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Ob;t--<=0&&(yield i)}}.call(this)}function acr(t,e=void 0){return e!=null&&mI(e,"options"),e?.signal!=null&&hI(e.signal,"options.signal"),t=Gut(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ob;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Ob;if(t-- >0&&(yield i),t<=0)return}}.call(this)}gbe.exports.streamReturningOperators={asIndexedPairs:Vlr(Zlr,"readable.asIndexedPairs will be removed in a future version."),drop:icr,filter:mbe,flatMap:ocr,map:Z7,take:acr,compose:Xlr};gbe.exports.promiseReturningOperators={every:Qlr,forEach:tcr,reduce:rcr,toArray:ncr,some:Jut,find:ecr}});var ybe=b((fto,Yut)=>{"use strict";var{ArrayPrototypePop:scr,Promise:ucr}=ha(),{isIterable:lcr,isNodeStream:ccr,isWebStream:dcr}=wb(),{pipelineImpl:fcr}=G7(),{finished:pcr}=Hx();bbe();function hcr(...t){return new ucr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!ccr(i)&&!lcr(i)&&!dcr(i)){let a=scr(t);n=a.signal,o=a.end}fcr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}Yut.exports={finished:pcr,pipeline:hcr}});var bbe=b((pto,ilt)=>{var{Buffer:mcr}=hg(),{ObjectDefineProperty:Jx,ObjectKeys:Qut,ReflectApply:elt}=ha(),{promisify:{custom:tlt}}=rd(),{streamReturningOperators:Xut,promiseReturningOperators:Zut}=Kut(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:rlt}}=qd(),gcr=pbe(),{setDefaultHighWaterMark:ycr,getDefaultHighWaterMark:bcr}=V2(),{pipeline:nlt}=G7(),{destroyer:_cr}=uI(),olt=Hx(),_be=ybe(),t4=wb(),Ci=ilt.exports=R7().Stream;Ci.isDestroyed=t4.isDestroyed;Ci.isDisturbed=t4.isDisturbed;Ci.isErrored=t4.isErrored;Ci.isReadable=t4.isReadable;Ci.isWritable=t4.isWritable;Ci.Readable=G2();for(let t of Qut(Xut)){let r=function(...n){if(new.target)throw rlt();return Ci.Readable.from(elt(e,this,n))};wcr=r;let e=Xut[t];Jx(r,"name",{__proto__:null,value:e.name}),Jx(r,"length",{__proto__:null,value:e.length}),Jx(Ci.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var wcr;for(let t of Qut(Zut)){let r=function(...o){if(new.target)throw rlt();return elt(e,this,o)};wcr=r;let e=Zut[t];Jx(r,"name",{__proto__:null,value:e.name}),Jx(r,"length",{__proto__:null,value:e.length}),Jx(Ci.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var wcr;Ci.Writable=H7();Ci.Duplex=Cb();Ci.Transform=ebe();Ci.PassThrough=rbe();Ci.pipeline=nlt;var{addAbortSignal:vcr}=H2();Ci.addAbortSignal=vcr;Ci.finished=olt;Ci.destroy=_cr;Ci.compose=gcr;Ci.setDefaultHighWaterMark=ycr;Ci.getDefaultHighWaterMark=bcr;Jx(Ci,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _be}});Jx(nlt,tlt,{__proto__:null,enumerable:!0,get(){return _be.pipeline}});Jx(olt,tlt,{__proto__:null,enumerable:!0,get(){return _be.finished}});Ci.Stream=Ci;Ci._isUint8Array=function(e){return e instanceof Uint8Array};Ci._uint8ArrayToBuffer=function(e){return mcr.from(e.buffer,e.byteOffset,e.byteLength)}});var r4=b((hto,ss)=>{"use strict";var el=bbe(),Scr=ybe(),xcr=el.Readable.destroy;ss.exports=el.Readable;ss.exports._uint8ArrayToBuffer=el._uint8ArrayToBuffer;ss.exports._isUint8Array=el._isUint8Array;ss.exports.isDisturbed=el.isDisturbed;ss.exports.isErrored=el.isErrored;ss.exports.isReadable=el.isReadable;ss.exports.Readable=el.Readable;ss.exports.Writable=el.Writable;ss.exports.Duplex=el.Duplex;ss.exports.Transform=el.Transform;ss.exports.PassThrough=el.PassThrough;ss.exports.addAbortSignal=el.addAbortSignal;ss.exports.finished=el.finished;ss.exports.destroy=el.destroy;ss.exports.destroy=xcr;ss.exports.pipeline=el.pipeline;ss.exports.compose=el.compose;Object.defineProperty(el,"promises",{configurable:!0,enumerable:!0,get(){return Scr}});ss.exports.Stream=el.Stream;ss.exports.default=ss.exports});var gI=b((mto,alt)=>{"use strict";alt.exports=TypeError});var slt=b(()=>{});var a4=b((bto,Plt)=>{var Mbe=typeof Map=="function"&&Map.prototype,vbe=Object.getOwnPropertyDescriptor&&Mbe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,eY=Mbe&&vbe&&typeof vbe.get=="function"?vbe.get:null,ult=Mbe&&Map.prototype.forEach,Abe=typeof Set=="function"&&Set.prototype,wbe=Object.getOwnPropertyDescriptor&&Abe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,tY=Abe&&wbe&&typeof wbe.get=="function"?wbe.get:null,llt=Abe&&Set.prototype.forEach,Ccr=typeof WeakMap=="function"&&WeakMap.prototype,o4=Ccr?WeakMap.prototype.has:null,Ocr=typeof WeakSet=="function"&&WeakSet.prototype,i4=Ocr?WeakSet.prototype.has:null,Ecr=typeof WeakRef=="function"&&WeakRef.prototype,clt=Ecr?WeakRef.prototype.deref:null,Pcr=Boolean.prototype.valueOf,Tcr=Object.prototype.toString,Mcr=Function.prototype.toString,Acr=String.prototype.match,Rbe=String.prototype.slice,PP=String.prototype.replace,Rcr=String.prototype.toUpperCase,dlt=String.prototype.toLowerCase,vlt=RegExp.prototype.test,flt=Array.prototype.concat,Eb=Array.prototype.join,Icr=Array.prototype.slice,plt=Math.floor,Cbe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Sbe=Object.getOwnPropertySymbols,Obe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,QL=typeof Symbol=="function"&&typeof Symbol.iterator=="object",od=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===QL||"symbol")?Symbol.toStringTag:null,wlt=Object.prototype.propertyIsEnumerable,hlt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function mlt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||vlt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-plt(-t):plt(t);if(n!==t){var o=String(n),i=Rbe.call(e,o.length+1);return PP.call(o,r,"$&_")+"."+PP.call(PP.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return PP.call(e,r,"$&_")}var Ebe=slt(),glt=Ebe.custom,ylt=Clt(glt)?glt:null,Slt={__proto__:null,double:'"',single:"'"},Dcr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Plt.exports=function t(e,r,n,o){var i=r||{};if(Gx(i,"quoteStyle")&&!Gx(Slt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Gx(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=Gx(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(Gx(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(Gx(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Elt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?mlt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?mlt(e,l):l}var c=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return Pbe(e)?"[Array]":"[Object]";var d=Xcr(i,n);if(typeof o>"u")o=[];else if(Olt(o,e)>=0)return"[Circular]";function f(F,L,q){if(L&&(o=Icr.call(o),o.push(L)),q){var U={depth:i.depth};return Gx(i,"quoteStyle")&&(U.quoteStyle=i.quoteStyle),t(F,U,n+1,o)}return t(F,i,n+1,o)}if(typeof e=="function"&&!blt(e)){var p=Ucr(e),h=Q7(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+Eb.call(h,", ")+" }":"")}if(Clt(e)){var m=QL?PP.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Obe.call(e);return typeof e=="object"&&!QL?n4(m):m}if(Gcr(e)){for(var v="<"+dlt.call(String(e.nodeName)),g=e.attributes||[],_=0;_<g.length;_++)v+=" "+g[_].name+"="+xlt(jcr(g[_].value),"double",i);return v+=">",e.childNodes&&e.childNodes.length&&(v+="..."),v+="</"+dlt.call(String(e.nodeName))+">",v}if(Pbe(e)){if(e.length===0)return"[]";var S=Q7(e,f);return d&&!Ycr(S)?"["+Tbe(S,d)+"]":"[ "+Eb.call(S,", ")+" ]"}if(Lcr(e)){var x=Q7(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!wlt.call(e,"cause")?"{ ["+String(e)+"] "+Eb.call(flt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Eb.call(x,", ")+" }"}if(typeof e=="object"&&a){if(ylt&&typeof e[ylt]=="function"&&Ebe)return Ebe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(zcr(e)){var O=[];return ult&&ult.call(e,function(F,L){O.push(f(L,e,!0)+" => "+f(F,e))}),_lt("Map",eY.call(e),O,d)}if(Wcr(e)){var T=[];return llt&&llt.call(e,function(F){T.push(f(F,e))}),_lt("Set",tY.call(e),T,d)}if(Hcr(e))return xbe("WeakMap");if(Jcr(e))return xbe("WeakSet");if(Vcr(e))return xbe("WeakRef");if(kcr(e))return n4(f(Number(e)));if($cr(e))return n4(f(Cbe.call(e)));if(Bcr(e))return n4(Pcr.call(e));if(Fcr(e))return n4(f(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof window<"u"&&e===window)return"{ [object globalThis] }";if(!Ncr(e)&&!blt(e)){var E=Q7(e,f),M=hlt?hlt(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",N=!M&&od&&Object(e)===e&&od in e?Rbe.call(TP(e),8,-1):R?"Object":"",j=M||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",k=j+(N||R?"["+Eb.call(flt.call([],N||[],R||[]),": ")+"] ":"");return E.length===0?k+"{}":d?k+"{"+Tbe(E,d)+"}":k+"{ "+Eb.call(E,", ")+" }"}return String(e)};function xlt(t,e,r){var n=r.quoteStyle||e,o=Slt[n];return o+t+o}function jcr(t){return PP.call(String(t),/"/g,"&quot;")}function Pbe(t){return TP(t)==="[object Array]"&&(!od||!(typeof t=="object"&&od in t))}function Ncr(t){return TP(t)==="[object Date]"&&(!od||!(typeof t=="object"&&od in t))}function blt(t){return TP(t)==="[object RegExp]"&&(!od||!(typeof t=="object"&&od in t))}function Lcr(t){return TP(t)==="[object Error]"&&(!od||!(typeof t=="object"&&od in t))}function Fcr(t){return TP(t)==="[object String]"&&(!od||!(typeof t=="object"&&od in t))}function kcr(t){return TP(t)==="[object Number]"&&(!od||!(typeof t=="object"&&od in t))}function Bcr(t){return TP(t)==="[object Boolean]"&&(!od||!(typeof t=="object"&&od in t))}function Clt(t){if(QL)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Obe)return!1;try{return Obe.call(t),!0}catch{}return!1}function $cr(t){if(!t||typeof t!="object"||!Cbe)return!1;try{return Cbe.call(t),!0}catch{}return!1}var qcr=Object.prototype.hasOwnProperty||function(t){return t in this};function Gx(t,e){return qcr.call(t,e)}function TP(t){return Tcr.call(t)}function Ucr(t){if(t.name)return t.name;var e=Acr.call(Mcr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Olt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function zcr(t){if(!eY||!t||typeof t!="object")return!1;try{eY.call(t);try{tY.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Hcr(t){if(!o4||!t||typeof t!="object")return!1;try{o4.call(t,o4);try{i4.call(t,i4)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Vcr(t){if(!clt||!t||typeof t!="object")return!1;try{return clt.call(t),!0}catch{}return!1}function Wcr(t){if(!tY||!t||typeof t!="object")return!1;try{tY.call(t);try{eY.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Jcr(t){if(!i4||!t||typeof t!="object")return!1;try{i4.call(t,i4);try{o4.call(t,o4)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Gcr(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Elt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Elt(Rbe.call(t,0,e.maxStringLength),e)+n}var o=Dcr[e.quoteStyle||"single"];o.lastIndex=0;var i=PP.call(PP.call(t,o,"\\$1"),/[\x00-\x1f]/g,Kcr);return xlt(i,"single",e)}function Kcr(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Rcr.call(e.toString(16))}function n4(t){return"Object("+t+")"}function xbe(t){return t+" { ? }"}function _lt(t,e,r,n){var o=n?Tbe(r,n):Eb.call(r,", ");return t+" ("+e+") {"+o+"}"}function Ycr(t){for(var e=0;e<t.length;e++)if(Olt(t[e],`
`)>=0)return!1;return!0}function Xcr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Eb.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Eb.call(Array(e+1),r)}}function Tbe(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+Eb.call(t,","+r)+`
`+e.prev}function Q7(t,e){var r=Pbe(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=Gx(t,o)?e(t[o],t):""}var i=typeof Sbe=="function"?Sbe(t):[],a;if(QL){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)Gx(t,u)&&(r&&String(Number(u))===u&&u<t.length||QL&&a["$"+u]instanceof Symbol||(vlt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof Sbe=="function")for(var l=0;l<i.length;l++)wlt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var Mlt=b((_to,Tlt)=>{"use strict";var Zcr=a4(),Qcr=gI(),rY=function(t,e,r){for(var n=t,o;(o=n.next)!=null;n=o)if(o.key===e)return n.next=o.next,r||(o.next=t.next,t.next=o),o},edr=function(t,e){if(t){var r=rY(t,e);return r&&r.value}},tdr=function(t,e,r){var n=rY(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},rdr=function(t,e){return t?!!rY(t,e):!1},ndr=function(t,e){if(t)return rY(t,e,!0)};Tlt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Qcr("Side channel does not contain "+Zcr(n))},delete:function(n){var o=e&&e.next,i=ndr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return edr(e,n)},has:function(n){return rdr(e,n)},set:function(n,o){e||(e={next:void 0}),tdr(e,n,o)}};return r}});var Ibe=b((vto,Alt)=>{"use strict";Alt.exports=Object});var Ilt=b((wto,Rlt)=>{"use strict";Rlt.exports=Error});var jlt=b((Sto,Dlt)=>{"use strict";Dlt.exports=EvalError});var Llt=b((xto,Nlt)=>{"use strict";Nlt.exports=RangeError});var klt=b((Cto,Flt)=>{"use strict";Flt.exports=ReferenceError});var $lt=b((Oto,Blt)=>{"use strict";Blt.exports=SyntaxError});var Ult=b((Eto,qlt)=>{"use strict";qlt.exports=URIError});var Hlt=b((Pto,zlt)=>{"use strict";zlt.exports=Math.abs});var Wlt=b((Tto,Vlt)=>{"use strict";Vlt.exports=Math.floor});var Glt=b((Mto,Jlt)=>{"use strict";Jlt.exports=Math.max});var Ylt=b((Ato,Klt)=>{"use strict";Klt.exports=Math.min});var Zlt=b((Rto,Xlt)=>{"use strict";Xlt.exports=Math.pow});var ect=b((Ito,Qlt)=>{"use strict";Qlt.exports=Math.round});var rct=b((Dto,tct)=>{"use strict";tct.exports=Number.isNaN||function(e){return e!==e}});var oct=b((jto,nct)=>{"use strict";var odr=rct();nct.exports=function(e){return odr(e)||e===0?e:e<0?-1:1}});var act=b((Nto,ict)=>{"use strict";ict.exports=Object.getOwnPropertyDescriptor});var Dbe=b((Lto,sct)=>{"use strict";var nY=act();if(nY)try{nY([],"length")}catch{nY=null}sct.exports=nY});var lct=b((Fto,uct)=>{"use strict";var oY=Object.defineProperty||!1;if(oY)try{oY({},"a",{value:1})}catch{oY=!1}uct.exports=oY});var dct=b((kto,cct)=>{"use strict";cct.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==o||s.enumerable!==!0)return!1}return!0}});var hct=b((Bto,pct)=>{"use strict";var fct=typeof Symbol<"u"&&Symbol,idr=dct();pct.exports=function(){return typeof fct!="function"||typeof Symbol!="function"||typeof fct("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:idr()}});var jbe=b(($to,mct)=>{"use strict";mct.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Nbe=b((qto,gct)=>{"use strict";var adr=Ibe();gct.exports=adr.getPrototypeOf||null});var _ct=b((Uto,bct)=>{"use strict";var sdr="Function.prototype.bind called on incompatible ",udr=Object.prototype.toString,ldr=Math.max,cdr="[object Function]",yct=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},ddr=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},fdr=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};bct.exports=function(e){var r=this;if(typeof r!="function"||udr.apply(r)!==cdr)throw new TypeError(sdr+r);for(var n=ddr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,yct(n,arguments));return Object(c)===c?c:this}return r.apply(e,yct(n,arguments))},a=ldr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+fdr(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 s4=b((zto,vct)=>{"use strict";var pdr=_ct();vct.exports=Function.prototype.bind||pdr});var iY=b((Hto,wct)=>{"use strict";wct.exports=Function.prototype.call});var Lbe=b((Vto,Sct)=>{"use strict";Sct.exports=Function.prototype.apply});var Cct=b((Wto,xct)=>{"use strict";xct.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ect=b((Jto,Oct)=>{"use strict";var hdr=s4(),mdr=Lbe(),gdr=iY(),ydr=Cct();Oct.exports=ydr||hdr.call(gdr,mdr)});var Fbe=b((Gto,Pct)=>{"use strict";var bdr=s4(),_dr=gI(),vdr=iY(),wdr=Ect();Pct.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new _dr("a function is required");return wdr(bdr,vdr,e)}});var Dct=b((Kto,Ict)=>{"use strict";var Sdr=Fbe(),Tct=Dbe(),Act;try{Act=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var kbe=!!Act&&Tct&&Tct(Object.prototype,"__proto__"),Rct=Object,Mct=Rct.getPrototypeOf;Ict.exports=kbe&&typeof kbe.get=="function"?Sdr([kbe.get]):typeof Mct=="function"?function(e){return Mct(e==null?e:Rct(e))}:!1});var kct=b((Yto,Fct)=>{"use strict";var jct=jbe(),Nct=Nbe(),Lct=Dct();Fct.exports=jct?function(e){return jct(e)}:Nct?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Nct(e)}:Lct?function(e){return Lct(e)}:null});var $ct=b((Xto,Bct)=>{"use strict";var xdr=Function.prototype.call,Cdr=Object.prototype.hasOwnProperty,Odr=s4();Bct.exports=Odr.call(xdr,Cdr)});var uY=b((Zto,Wct)=>{"use strict";var un,Edr=Ibe(),Pdr=Ilt(),Tdr=jlt(),Mdr=Llt(),Adr=klt(),nF=$lt(),rF=gI(),Rdr=Ult(),Idr=Hlt(),Ddr=Wlt(),jdr=Glt(),Ndr=Ylt(),Ldr=Zlt(),Fdr=ect(),kdr=oct(),Hct=Function,Bbe=function(t){try{return Hct('"use strict"; return ('+t+").constructor;")()}catch{}},u4=Dbe(),Bdr=lct(),$be=function(){throw new rF},$dr=u4?function(){try{return arguments.callee,$be}catch{try{return u4(arguments,"callee").get}catch{return $be}}}():$be,eF=hct()(),El=kct(),qdr=Nbe(),Udr=jbe(),Vct=Lbe(),l4=iY(),tF={},zdr=typeof Uint8Array>"u"||!El?un:El(Uint8Array),yI={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?un:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?un:ArrayBuffer,"%ArrayIteratorPrototype%":eF&&El?El([][Symbol.iterator]()):un,"%AsyncFromSyncIteratorPrototype%":un,"%AsyncFunction%":tF,"%AsyncGenerator%":tF,"%AsyncGeneratorFunction%":tF,"%AsyncIteratorPrototype%":tF,"%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%":Pdr,"%eval%":eval,"%EvalError%":Tdr,"%Float32Array%":typeof Float32Array>"u"?un:Float32Array,"%Float64Array%":typeof Float64Array>"u"?un:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?un:FinalizationRegistry,"%Function%":Hct,"%GeneratorFunction%":tF,"%Int8Array%":typeof Int8Array>"u"?un:Int8Array,"%Int16Array%":typeof Int16Array>"u"?un:Int16Array,"%Int32Array%":typeof Int32Array>"u"?un:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":eF&&El?El(El([][Symbol.iterator]())):un,"%JSON%":typeof JSON=="object"?JSON:un,"%Map%":typeof Map>"u"?un:Map,"%MapIteratorPrototype%":typeof Map>"u"||!eF||!El?un:El(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Edr,"%Object.getOwnPropertyDescriptor%":u4,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?un:Promise,"%Proxy%":typeof Proxy>"u"?un:Proxy,"%RangeError%":Mdr,"%ReferenceError%":Adr,"%Reflect%":typeof Reflect>"u"?un:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?un:Set,"%SetIteratorPrototype%":typeof Set>"u"||!eF||!El?un:El(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?un:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":eF&&El?El(""[Symbol.iterator]()):un,"%Symbol%":eF?Symbol:un,"%SyntaxError%":nF,"%ThrowTypeError%":$dr,"%TypedArray%":zdr,"%TypeError%":rF,"%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%":Rdr,"%WeakMap%":typeof WeakMap>"u"?un:WeakMap,"%WeakRef%":typeof WeakRef>"u"?un:WeakRef,"%WeakSet%":typeof WeakSet>"u"?un:WeakSet,"%Function.prototype.call%":l4,"%Function.prototype.apply%":Vct,"%Object.defineProperty%":Bdr,"%Object.getPrototypeOf%":qdr,"%Math.abs%":Idr,"%Math.floor%":Ddr,"%Math.max%":jdr,"%Math.min%":Ndr,"%Math.pow%":Ldr,"%Math.round%":Fdr,"%Math.sign%":kdr,"%Reflect.getPrototypeOf%":Udr};if(El)try{null.error}catch(t){qct=El(El(t)),yI["%Error.prototype%"]=qct}var qct,Hdr=function t(e){var r;if(e==="%AsyncFunction%")r=Bbe("async function () {}");else if(e==="%GeneratorFunction%")r=Bbe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Bbe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&El&&(r=El(o.prototype))}return yI[e]=r,r},Uct={__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"]},c4=s4(),aY=$ct(),Vdr=c4.call(l4,Array.prototype.concat),Wdr=c4.call(Vct,Array.prototype.splice),zct=c4.call(l4,String.prototype.replace),sY=c4.call(l4,String.prototype.slice),Jdr=c4.call(l4,RegExp.prototype.exec),Gdr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Kdr=/\\(\\)?/g,Ydr=function(e){var r=sY(e,0,1),n=sY(e,-1);if(r==="%"&&n!=="%")throw new nF("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new nF("invalid intrinsic syntax, expected opening `%`");var o=[];return zct(e,Gdr,function(i,a,s,u){o[o.length]=s?zct(u,Kdr,"$1"):a||i}),o},Xdr=function(e,r){var n=e,o;if(aY(Uct,n)&&(o=Uct[n],n="%"+o[0]+"%"),aY(yI,n)){var i=yI[n];if(i===tF&&(i=Hdr(n)),typeof i>"u"&&!r)throw new rF("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new nF("intrinsic "+e+" does not exist!")};Wct.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new rF("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new rF('"allowMissing" argument must be a boolean');if(Jdr(/^%?[^%]*%?$/,e)===null)throw new nF("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ydr(e),o=n.length>0?n[0]:"",i=Xdr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],Wdr(n,Vdr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=sY(f,0,1),h=sY(f,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new nF("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",aY(yI,a))s=yI[a];else if(s!=null){if(!(f in s)){if(!r)throw new rF("base intrinsic for "+e+" exists, but the property is not available.");return}if(u4&&c+1>=n.length){var m=u4(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=aY(s,f),s=s[f];d&&!u&&(yI[a]=s)}}return s}});var qbe=b((Qto,Kct)=>{"use strict";var Jct=uY(),Gct=Fbe(),Zdr=Gct([Jct("%String.prototype.indexOf%")]);Kct.exports=function(e,r){var n=Jct(e,!!r);return typeof n=="function"&&Zdr(e,".prototype.")>-1?Gct([n]):n}});var Ube=b((ero,Xct)=>{"use strict";var Qdr=uY(),d4=qbe(),efr=a4(),tfr=gI(),Yct=Qdr("%Map%",!0),rfr=d4("Map.prototype.get",!0),nfr=d4("Map.prototype.set",!0),ofr=d4("Map.prototype.has",!0),ifr=d4("Map.prototype.delete",!0),afr=d4("Map.prototype.size",!0);Xct.exports=!!Yct&&function(){var e,r={assert:function(n){if(!r.has(n))throw new tfr("Side channel does not contain "+efr(n))},delete:function(n){if(e){var o=ifr(e,n);return afr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return rfr(e,n)},has:function(n){return e?ofr(e,n):!1},set:function(n,o){e||(e=new Yct),nfr(e,n,o)}};return r}});var Qct=b((tro,Zct)=>{"use strict";var sfr=uY(),cY=qbe(),ufr=a4(),lY=Ube(),lfr=gI(),oF=sfr("%WeakMap%",!0),cfr=cY("WeakMap.prototype.get",!0),dfr=cY("WeakMap.prototype.set",!0),ffr=cY("WeakMap.prototype.has",!0),pfr=cY("WeakMap.prototype.delete",!0);Zct.exports=oF?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new lfr("Side channel does not contain "+ufr(o))},delete:function(o){if(oF&&o&&(typeof o=="object"||typeof o=="function")){if(e)return pfr(e,o)}else if(lY&&r)return r.delete(o);return!1},get:function(o){return oF&&o&&(typeof o=="object"||typeof o=="function")&&e?cfr(e,o):r&&r.get(o)},has:function(o){return oF&&o&&(typeof o=="object"||typeof o=="function")&&e?ffr(e,o):!!r&&r.has(o)},set:function(o,i){oF&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new oF),dfr(e,o,i)):lY&&(r||(r=lY()),r.set(o,i))}};return n}:lY});var tdt=b((rro,edt)=>{"use strict";var hfr=gI(),mfr=a4(),gfr=Mlt(),yfr=Ube(),bfr=Qct(),_fr=bfr||yfr||gfr;edt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new hfr("Side channel does not contain "+mfr(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,o){e||(e=_fr()),e.set(n,o)}};return r}});var dY=b((nro,rdt)=>{"use strict";var vfr=String.prototype.replace,wfr=/%20/g,zbe={RFC1738:"RFC1738",RFC3986:"RFC3986"};rdt.exports={default:zbe.RFC3986,formatters:{RFC1738:function(t){return vfr.call(t,wfr,"+")},RFC3986:function(t){return String(t)}},RFC1738:zbe.RFC1738,RFC3986:zbe.RFC3986}});var Vbe=b((oro,odt)=>{"use strict";var Sfr=dY(),Hbe=Object.prototype.hasOwnProperty,bI=Array.isArray,Pb=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),xfr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(bI(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},ndt=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},Cfr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(bI(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Hbe.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var o=e;return bI(e)&&!bI(r)&&(o=ndt(e,n)),bI(e)&&bI(r)?(r.forEach(function(i,a){if(Hbe.call(e,a)){var s=e[a];s&&typeof s=="object"&&i&&typeof i=="object"?e[a]=t(s,i,n):e.push(i)}else e[a]=i}),e):Object.keys(r).reduce(function(i,a){var s=r[a];return Hbe.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},Ofr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},Efr=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Pfr=function(e,r,n,o,i){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;++u){var l=a.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===Sfr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Pb[l];continue}if(l<2048){s=s+(Pb[192|l>>6]+Pb[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Pb[224|l>>12]+Pb[128|l>>6&63]+Pb[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Pb[240|l>>18]+Pb[128|l>>12&63]+Pb[128|l>>6&63]+Pb[128|l&63]}return s},Tfr=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],o=0;o<r.length;++o)for(var i=r[o],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var l=s[u],c=a[l];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:a,prop:l}),n.push(c))}return xfr(r),e},Mfr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Afr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Rfr=function(e,r){return[].concat(e,r)},Ifr=function(e,r){if(bI(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};odt.exports={arrayToObject:ndt,assign:Ofr,combine:Rfr,compact:Tfr,decode:Efr,encode:Pfr,isBuffer:Afr,isRegExp:Mfr,maybeMap:Ifr,merge:Cfr}});var cdt=b((iro,ldt)=>{"use strict";var sdt=tdt(),fY=Vbe(),f4=dY(),Dfr=Object.prototype.hasOwnProperty,idt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Kx=Array.isArray,jfr=Array.prototype.push,udt=function(t,e){jfr.apply(t,Kx(e)?e:[e])},Nfr=Date.prototype.toISOString,adt=f4.default,id={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:fY.encode,encodeValuesOnly:!1,format:adt,formatter:f4.formatters[adt],indices:!1,serializeDate:function(e){return Nfr.call(e)},skipNulls:!1,strictNullHandling:!1},Lfr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Wbe={},Ffr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,v){for(var g=e,_=v,S=0,x=!1;(_=_.get(Wbe))!==void 0&&!x;){var O=_.get(e);if(S+=1,typeof O<"u"){if(O===S)throw new RangeError("Cyclic object value");x=!0}typeof _.get(Wbe)>"u"&&(S=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&Kx(g)&&(g=fY.maybeMap(g,function(U){return U instanceof Date?d(U):U})),g===null){if(i)return s&&!h?s(r,id.encoder,m,"key",f):r;g=""}if(Lfr(g)||fY.isBuffer(g)){if(s){var T=h?r:s(r,id.encoder,m,"key",f);return[p(T)+"="+p(s(g,id.encoder,m,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var M;if(n==="comma"&&Kx(g))h&&s&&(g=fY.maybeMap(g,s)),M=[{value:g.length>0?g.join(",")||null:void 0}];else if(Kx(u))M=u;else{var R=Object.keys(g);M=l?R.sort(l):R}for(var N=o&&Kx(g)&&g.length===1?r+"[]":r,j=0;j<M.length;++j){var k=M[j],F=typeof k=="object"&&typeof k.value<"u"?k.value:g[k];if(!(a&&F===null)){var L=Kx(g)?typeof n=="function"?n(N,k):N:N+(c?"."+k:"["+k+"]");v.set(e,S);var q=sdt();q.set(Wbe,v),udt(E,t(F,L,n,o,i,a,n==="comma"&&h&&Kx(g)?null:s,u,l,c,d,f,p,h,m,q))}}return E},kfr=function(e){if(!e)return id;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||id.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=f4.default;if(typeof e.format<"u"){if(!Dfr.call(f4.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=f4.formatters[n],i=id.filter;return(typeof e.filter=="function"||Kx(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:id.addQueryPrefix,allowDots:typeof e.allowDots>"u"?id.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:id.charsetSentinel,delimiter:typeof e.delimiter>"u"?id.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:id.encode,encoder:typeof e.encoder=="function"?e.encoder:id.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:id.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:id.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:id.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:id.strictNullHandling}};ldt.exports=function(t,e){var r=t,n=kfr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Kx(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in idt?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=idt[s];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=u==="comma"&&e&&e.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var c=sdt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||udt(a,Ffr(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 pdt=b((aro,fdt)=>{"use strict";var iF=Vbe(),Jbe=Object.prototype.hasOwnProperty,Bfr=Array.isArray,Pl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:iF.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},$fr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},ddt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},qfr="utf8=%26%2310003%3B",Ufr="utf8=%E2%9C%93",zfr=function(e,r){var n={__proto__:null},o=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,i),s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===Ufr?l="utf-8":a[u]===qfr&&(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,Pl.decoder,l,"key"),h=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Pl.decoder,l,"key"),h=iF.maybeMap(ddt(c.slice(f+1),r),function(m){return r.decoder(m,Pl.decoder,l,"value")})),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=$fr(h)),c.indexOf("[]=")>-1&&(h=Bfr(h)?[h]:h),Jbe.call(n,p)?n[p]=iF.combine(n[p],h):n[p]=h}return n},Hfr=function(t,e,r,n){for(var o=n?e:ddt(e,r),i=t.length-1;i>=0;--i){var a,s=t[i];if(s==="[]"&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var u=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,l=parseInt(u,10);!r.parseArrays&&u===""?a={0:o}:!isNaN(l)&&s!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(a=[],a[l]=o):u!=="__proto__"&&(a[u]=o)}o=a}return o},Vfr=function(e,r,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),l=u?i.slice(0,u.index):i,c=[];if(l){if(!n.plainObjects&&Jbe.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&&Jbe.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),Hfr(c,r,n,o)}},Wfr=function(e){if(!e)return Pl;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?Pl.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Pl.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Pl.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Pl.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Pl.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pl.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Pl.comma,decoder:typeof e.decoder=="function"?e.decoder:Pl.decoder,delimiter:typeof e.delimiter=="string"||iF.isRegExp(e.delimiter)?e.delimiter:Pl.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Pl.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Pl.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Pl.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Pl.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pl.strictNullHandling}};fdt.exports=function(t,e){var r=Wfr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?zfr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=Vfr(s,n[s],r,typeof t=="string");o=iF.merge(o,u,r)}return r.allowSparse===!0?o:iF.compact(o)}});var mdt=b((sro,hdt)=>{"use strict";var Jfr=cdt(),Gfr=pdt(),Kfr=dY();hdt.exports={formats:Kfr,parse:Gfr,stringify:Jfr}});var gdt=b(aF=>{"use strict";var Yfr=aF&&aF.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(aF,"__esModule",{value:!0});aF.createRequestUrl=void 0;var Xfr=Yfr(mdt());function Zfr(t,e){return Object.keys(e??{}).length>0?`${t}?${Xfr.default.stringify(e,{arrayFormat:"repeat"})}`:t}aF.createRequestUrl=Zfr});var _dt=b(pY=>{"use strict";var Gbe,Kbe,Ybe,Xbe,Zbe;Object.defineProperty(pY,"__esModule",{value:!0});pY.RUNTIME=void 0;var Qfr=typeof window<"u"&&typeof window.document<"u",epr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((Gbe=self.constructor)===null||Gbe===void 0?void 0:Gbe.name)==="DedicatedWorkerGlobalScope"||((Kbe=self.constructor)===null||Kbe===void 0?void 0:Kbe.name)==="ServiceWorkerGlobalScope"||((Ybe=self.constructor)===null||Ybe===void 0?void 0:Ybe.name)==="SharedWorkerGlobalScope"),ydt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",bdt=typeof Bun<"u"&&typeof Bun.version<"u",tpr=typeof process<"u"&&Boolean(process.version)&&Boolean((Xbe=process.versions)===null||Xbe===void 0?void 0:Xbe.node)&&!ydt&&!bdt,rpr=typeof navigator<"u"&&navigator?.product==="ReactNative",npr=typeof globalThis<"u"&&((Zbe=globalThis?.navigator)===null||Zbe===void 0?void 0:Zbe.userAgent)==="Cloudflare-Workers";pY.RUNTIME=opr();function opr(){return Qfr?{type:"browser",version:window.navigator.userAgent}:npr?{type:"workerd"}:epr?{type:"web-worker"}:ydt?{type:"deno",version:Deno.version.deno}:bdt?{type:"bun",version:Bun.version}:tpr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:rpr?{type:"react-native"}:{type:"unknown"}}});var sF=b(hY=>{"use strict";Object.defineProperty(hY,"__esModule",{value:!0});hY.RUNTIME=void 0;var ipr=_dt();Object.defineProperty(hY,"RUNTIME",{enumerable:!0,get:function(){return ipr.RUNTIME}})});var Qbe=b((uF,vdt)=>{"use strict";var apr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},_I=apr();vdt.exports=uF=_I.fetch;_I.fetch&&(uF.default=_I.fetch.bind(_I));uF.Headers=_I.Headers;uF.Request=_I.Request;uF.Response=_I.Response});var Sdt=b(kh=>{"use strict";var spr=kh&&kh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),upr=kh&&kh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wdt=kh&&kh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&spr(e,t,r);return upr(e,t),e},lpr=kh&&kh.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(kh,"__esModule",{value:!0});kh.getFetchFn=void 0;var mY=sF();function cpr(){return lpr(this,void 0,void 0,function*(){return mY.RUNTIME.type==="node"&&mY.RUNTIME.parsedVersion!=null&&mY.RUNTIME.parsedVersion>=18?fetch:mY.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>wdt(Qbe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>wdt(Qbe()))).default})}kh.getFetchFn=cpr});var xdt=b(lF=>{"use strict";var dpr=lF&&lF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(lF,"__esModule",{value:!0});lF.getRequestBody=void 0;function fpr({body:t,type:e}){return dpr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}lF.getRequestBody=fpr});var Cdt=b(cF=>{"use strict";var Sg=cF&&cF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(cF,"__esModule",{value:!0});cF.Node18UniversalStreamWrapper=void 0;var Tb=class{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>Sg(this,void 0,void 0,function*(){if(e instanceof Tb)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.on("end",()=>Sg(this,void 0,void 0,function*(){e instanceof Tb?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>Sg(this,void 0,void 0,function*(){e instanceof Tb?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)})),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>Sg(this,void 0,void 0,function*(){if(e instanceof Tb)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.off("end",()=>Sg(this,void 0,void 0,function*(){e instanceof Tb?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>Sg(this,void 0,void 0,function*(){e instanceof Tb?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)}))}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return Sg(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return Sg(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return Sg(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return Sg(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>Sg(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};cF.Node18UniversalStreamWrapper=Tb});var Odt=b(dF=>{"use strict";var p4=dF&&dF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(dF,"__esModule",{value:!0});dF.UndiciStreamWrapper=void 0;var Mb=class{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>{if(e instanceof Mb)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.on("end",()=>{e instanceof Mb?e._end():e.getWriter().close()}),this.on("error",r=>{e instanceof Mb?e._error(r):e.getWriter().abort(r)}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>{if(e instanceof Mb)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.off("end",()=>{e instanceof Mb?e._end():e.getWriter().close()}),this.off("error",r=>{e instanceof Mb?e._error(r):e.getWriter().abort(r)})}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return p4(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return p4(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return p4(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return p4(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>p4(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};dF.UndiciStreamWrapper=Mb});var Edt=b(MP=>{"use strict";var gY=MP&&MP.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},ppr=MP&&MP.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(MP,"__esModule",{value:!0});MP.NodePre18StreamWrapper=void 0;var e_e=class{constructor(e){this.readableStream=e}on(e,r){this.readableStream.on(e,r)}off(e,r){this.readableStream.off(e,r)}pipe(e){return this.readableStream.pipe(e),e}pipeTo(e){return this.pipe(e)}unpipe(e){e?this.readableStream.unpipe(e):this.readableStream.unpipe()}destroy(e){this.readableStream.destroy(e)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}read(){return gY(this,void 0,void 0,function*(){return new Promise((e,r)=>{let n=this.readableStream.read();n?e(n):(this.readableStream.once("readable",()=>{let o=this.readableStream.read();e(o)}),this.readableStream.once("error",r))})})}setEncoding(e){this.readableStream.setEncoding(e),this.encoding=e}text(){var e,r;return gY(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=ppr(this.readableStream),a;a=yield i.next(),!a.done;){let u=a.value;n.push(o.encode(u))}}catch(u){e={error:u}}finally{try{a&&!a.done&&(r=i.return)&&(yield r.call(i))}finally{if(e)throw e.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(n))})}json(){return gY(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return{next(){return gY(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};MP.NodePre18StreamWrapper=e_e});var Pdt=b(Bh=>{"use strict";var hpr=Bh&&Bh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mpr=Bh&&Bh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t_e=Bh&&Bh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hpr(e,t,r);return mpr(e,t),e},gpr=Bh&&Bh.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Bh,"__esModule",{value:!0});Bh.chooseStreamWrapper=void 0;var yY=sF();function ypr(t){return gpr(this,void 0,void 0,function*(){return yY.RUNTIME.type==="node"&&yY.RUNTIME.parsedVersion!=null&&yY.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>t_e(Cdt()))).Node18UniversalStreamWrapper(t):yY.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>t_e(Odt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>t_e(Edt()))).NodePre18StreamWrapper(t)})}Bh.chooseStreamWrapper=ypr});var Tdt=b(fF=>{"use strict";var bpr=fF&&fF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(fF,"__esModule",{value:!0});fF.getResponseBody=void 0;var _pr=Pdt();function vpr(t,e){return bpr(this,void 0,void 0,function*(){if(t.body!=null&&e==="blob")return yield t.blob();if(t.body!=null&&e==="sse")return t.body;if(t.body!=null&&e==="streaming")return(0,_pr.chooseStreamWrapper)(t.body);if(t.body!=null&&e==="text")return yield t.text();{let r=yield t.text();if(r.length>0)try{return JSON.parse(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:t.status,rawBody:r}}}else return}})}fF.getResponseBody=vpr});var Mdt=b(pF=>{"use strict";Object.defineProperty(pF,"__esModule",{value:!0});pF.anySignal=pF.getTimeoutSignal=void 0;var wpr="timeout";function Spr(t){let e=new AbortController,r=setTimeout(()=>e.abort(wpr),t);return{signal:e.signal,abortId:r}}pF.getTimeoutSignal=Spr;function xpr(...t){let e=t.length===1&&Array.isArray(t[0])?t[0]:t,r=new AbortController;for(let n of e){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}pF.anySignal=xpr});var Rdt=b(hF=>{"use strict";var Cpr=hF&&hF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(hF,"__esModule",{value:!0});hF.makeRequest=void 0;var Adt=Mdt(),Opr=(t,e,r,n,o,i,a,s,u)=>Cpr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:h}=(0,Adt.getTimeoutSignal)(i);c=h,l.push(p)}a!=null&&l.push(a);let d=(0,Adt.anySignal)(l),f=yield t(e,{method:r,headers:n,body:o,signal:d,credentials:s?"include":void 0,duplex:u});return c!=null&&clearTimeout(c),f});hF.makeRequest=Opr});var Idt=b(mF=>{"use strict";var Epr=mF&&mF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(mF,"__esModule",{value:!0});mF.requestWithRetries=void 0;var Ppr=1,Tpr=60,Mpr=2;function Apr(t,e=Mpr){return Epr(this,void 0,void 0,function*(){let r=yield t();for(let n=0;n<e&&([408,409,429].includes(r.status)||r.status>=500);++n){let o=Math.min(Ppr*Math.pow(2,n),Tpr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}mF.requestWithRetries=Apr});var Ndt=b(AP=>{"use strict";var Ddt=AP&&AP.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(AP,"__esModule",{value:!0});AP.fetcher=AP.fetcherImpl=void 0;var Rpr=gdt(),Ipr=Sdt(),Dpr=xdt(),jpr=Tdt(),Npr=Rdt(),Lpr=Idt();function jdt(t){return Ddt(this,void 0,void 0,function*(){let e={};if(t.body!==void 0&&t.contentType!=null&&(e["Content-Type"]=t.contentType),t.headers!=null)for(let[i,a]of Object.entries(t.headers))a!=null&&(e[i]=a);let r=(0,Rpr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,Dpr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,Ipr.getFetchFn)();try{let i=yield(0,Lpr.requestWithRetries)(()=>Ddt(this,void 0,void 0,function*(){return(0,Npr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,jpr.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a}}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"}}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message}}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(i)}}}})}AP.fetcherImpl=jdt;AP.fetcher=jdt});var Ldt=b(bY=>{"use strict";Object.defineProperty(bY,"__esModule",{value:!0});bY.getHeader=void 0;function Fpr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}bY.getHeader=Fpr});var Fdt=b(gF=>{"use strict";var kpr=gF&&gF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(gF,"__esModule",{value:!0});gF.Supplier=void 0;gF.Supplier={get:t=>kpr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var kdt=b(RP=>{"use strict";Object.defineProperty(RP,"__esModule",{value:!0});RP.Supplier=RP.getHeader=RP.fetcher=void 0;var Bpr=Ndt();Object.defineProperty(RP,"fetcher",{enumerable:!0,get:function(){return Bpr.fetcher}});var $pr=Ldt();Object.defineProperty(RP,"getHeader",{enumerable:!0,get:function(){return $pr.getHeader}});var qpr=Fdt();Object.defineProperty(RP,"Supplier",{enumerable:!0,get:function(){return qpr.Supplier}})});var Bdt=b((r_e,n_e)=>{(function(t,e){typeof r_e=="object"&&typeof n_e<"u"?n_e.exports=e():typeof define=="function"&&define.amd?define(e):function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n}()})(typeof self<"u"?self:typeof window<"u"||typeof window<"u"?window:r_e,function(){"use strict";var t="3.7.2",e=t,r=typeof atob=="function",n=typeof btoa=="function",o=typeof Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,a=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(s),l=function(Y){var Q={};return Y.forEach(function(le,Re){return Q[le]=Re}),Q}(u),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(Y,Q){return Q===void 0&&(Q=function(le){return le}),new Uint8Array(Array.prototype.slice.call(Y,0).map(Q))},p=function(Y){return Y.replace(/=/g,"").replace(/[+\/]/g,function(Q){return Q=="+"?"-":"_"})},h=function(Y){return Y.replace(/[^A-Za-z0-9\+\/]/g,"")},m=function(Y){for(var Q,le,Re,gt,Se="",ae=Y.length%3,ee=0;ee<Y.length;){if((le=Y.charCodeAt(ee++))>255||(Re=Y.charCodeAt(ee++))>255||(gt=Y.charCodeAt(ee++))>255)throw new TypeError("invalid character found");Q=le<<16|Re<<8|gt,Se+=u[Q>>18&63]+u[Q>>12&63]+u[Q>>6&63]+u[Q&63]}return ae?Se.slice(0,ae-3)+"===".substring(ae):Se},v=n?function(Y){return btoa(Y)}:o?function(Y){return Buffer.from(Y,"binary").toString("base64")}:m,g=o?function(Y){return Buffer.from(Y).toString("base64")}:function(Y){for(var Q=4096,le=[],Re=0,gt=Y.length;Re<gt;Re+=Q)le.push(d.apply(null,Y.subarray(Re,Re+Q)));return v(le.join(""))},_=function(Y,Q){return Q===void 0&&(Q=!1),Q?p(g(Y)):g(Y)},S=function(Y){if(Y.length<2){var Q=Y.charCodeAt(0);return Q<128?Y:Q<2048?d(192|Q>>>6)+d(128|Q&63):d(224|Q>>>12&15)+d(128|Q>>>6&63)+d(128|Q&63)}else{var Q=65536+(Y.charCodeAt(0)-55296)*1024+(Y.charCodeAt(1)-56320);return d(240|Q>>>18&7)+d(128|Q>>>12&63)+d(128|Q>>>6&63)+d(128|Q&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(Y){return Y.replace(x,S)},T=o?function(Y){return Buffer.from(Y,"utf8").toString("base64")}:a?function(Y){return g(a.encode(Y))}:function(Y){return v(O(Y))},E=function(Y,Q){return Q===void 0&&(Q=!1),Q?p(T(Y)):T(Y)},M=function(Y){return E(Y,!0)},R=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,N=function(Y){switch(Y.length){case 4:var Q=(7&Y.charCodeAt(0))<<18|(63&Y.charCodeAt(1))<<12|(63&Y.charCodeAt(2))<<6|63&Y.charCodeAt(3),le=Q-65536;return d((le>>>10)+55296)+d((le&1023)+56320);case 3:return d((15&Y.charCodeAt(0))<<12|(63&Y.charCodeAt(1))<<6|63&Y.charCodeAt(2));default:return d((31&Y.charCodeAt(0))<<6|63&Y.charCodeAt(1))}},j=function(Y){return Y.replace(R,N)},k=function(Y){if(Y=Y.replace(/\s+/g,""),!c.test(Y))throw new TypeError("malformed base64.");Y+="==".slice(2-(Y.length&3));for(var Q,le="",Re,gt,Se=0;Se<Y.length;)Q=l[Y.charAt(Se++)]<<18|l[Y.charAt(Se++)]<<12|(Re=l[Y.charAt(Se++)])<<6|(gt=l[Y.charAt(Se++)]),le+=Re===64?d(Q>>16&255):gt===64?d(Q>>16&255,Q>>8&255):d(Q>>16&255,Q>>8&255,Q&255);return le},F=r?function(Y){return atob(h(Y))}:o?function(Y){return Buffer.from(Y,"base64").toString("binary")}:k,L=o?function(Y){return f(Buffer.from(Y,"base64"))}:function(Y){return f(F(Y),function(Q){return Q.charCodeAt(0)})},q=function(Y){return L(G(Y))},U=o?function(Y){return Buffer.from(Y,"base64").toString("utf8")}:i?function(Y){return i.decode(L(Y))}:function(Y){return j(F(Y))},G=function(Y){return h(Y.replace(/[-_]/g,function(Q){return Q=="-"?"+":"/"}))},V=function(Y){return U(G(Y))},I=function(Y){if(typeof Y!="string")return!1;var Q=Y.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(Q)||!/[^\s0-9a-zA-Z\-_]/.test(Q)},H=function(Y){return{value:Y,enumerable:!1,writable:!0,configurable:!0}},W=function(){var Y=function(Q,le){return Object.defineProperty(String.prototype,Q,H(le))};Y("fromBase64",function(){return V(this)}),Y("toBase64",function(Q){return E(this,Q)}),Y("toBase64URI",function(){return E(this,!0)}),Y("toBase64URL",function(){return E(this,!0)}),Y("toUint8Array",function(){return q(this)})},J=function(){var Y=function(Q,le){return Object.defineProperty(Uint8Array.prototype,Q,H(le))};Y("toBase64",function(Q){return _(this,Q)}),Y("toBase64URI",function(){return _(this,!0)}),Y("toBase64URL",function(){return _(this,!0)})},re=function(){W(),J()},Ae={version:t,VERSION:e,atob:F,atobPolyfill:k,btoa:v,btoaPolyfill:m,fromBase64:V,toBase64:E,encode:E,encodeURI:M,encodeURL:M,utob:O,btou:j,decode:V,isValid:I,fromUint8Array:_,toUint8Array:q,extendString:W,extendUint8Array:J,extendBuiltins:re};return Ae.Base64={},Object.keys(Ae).forEach(function(Y){return Ae.Base64[Y]=Ae[Y]}),Ae})});var qdt=b(_Y=>{"use strict";Object.defineProperty(_Y,"__esModule",{value:!0});_Y.BasicAuth=void 0;var $dt=Bdt(),Upr=/^Basic /i;_Y.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${$dt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(Upr,""),r=$dt.Base64.decode(e),[n,o]=r.split(":",2);if(n==null||o==null)throw new Error("Invalid basic auth");return{username:n,password:o}}}});var Udt=b(vY=>{"use strict";Object.defineProperty(vY,"__esModule",{value:!0});vY.BearerToken=void 0;var zpr=/^Bearer /i;vY.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(zpr,"").trim()}});var zdt=b(yF=>{"use strict";Object.defineProperty(yF,"__esModule",{value:!0});yF.BearerToken=yF.BasicAuth=void 0;var Hpr=qdt();Object.defineProperty(yF,"BasicAuth",{enumerable:!0,get:function(){return Hpr.BasicAuth}});var Vpr=Udt();Object.defineProperty(yF,"BearerToken",{enumerable:!0,get:function(){return Vpr.BearerToken}})});var i_e=b(Of=>{"use strict";var Hdt=Of&&Of.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Vdt=Of&&Of.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},xg=Of&&Of.__await||function(t){return this instanceof xg?(this.v=t,this):new xg(t)},Wdt=Of&&Of.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof xg?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(Of,"__esModule",{value:!0});Of.readableStreamAsyncIterable=Of.Stream=void 0;var Wpr=sF(),Jpr="data:",o_e=class{constructor({stream:e,parse:r,eventShape:n,signal:o}){this.controller=new AbortController,this.stream=e,this.parse=r,n.type==="sse"?(this.prefix=Jpr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return Wdt(this,arguments,function*(){var r,n;this.controller.signal;let o=Jdt(this.stream),i="",a=!1;try{for(var s=Vdt(o),u;u=yield xg(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 xg(void 0);let f=yield xg(this.parse(JSON.parse(d)));yield yield xg(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield xg(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return Wdt(this,arguments,function*(){var r,n;try{for(var o=Vdt(this.iterMessages()),i;i=yield xg(o.next()),!i.done;){let a=i.value;yield yield xg(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield xg(n.call(o)))}finally{if(r)throw r.error}}})}decodeChunk(e){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(e)}else Wpr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Of.Stream=o_e;function Jdt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Hdt(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return Hdt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Of.readableStreamAsyncIterable=Jdt});var Gdt=b(wY=>{"use strict";Object.defineProperty(wY,"__esModule",{value:!0});wY.Stream=void 0;var Gpr=i_e();Object.defineProperty(wY,"Stream",{enumerable:!0,get:function(){return Gpr.Stream}})});var Xdt=b((Aro,Ydt)=>{"use strict";var a_e=Object.defineProperty,Kpr=Object.getOwnPropertyDescriptor,Ypr=Object.getOwnPropertyNames,Xpr=Object.prototype.hasOwnProperty,Zpr=(t,e)=>{for(var r in e)a_e(t,r,{get:e[r],enumerable:!0})},Qpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ypr(e))!Xpr.call(t,o)&&o!==r&&a_e(t,o,{get:()=>e[o],enumerable:!(n=Kpr(e,o))||n.enumerable});return t},ehr=t=>Qpr(a_e({},"__esModule",{value:!0}),t),Kdt={};Zpr(Kdt,{Blob:()=>nhr,File:()=>ohr,FormData:()=>rhr});Ydt.exports=ehr(Kdt);var thr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:rhr,Blob:nhr,File:ohr}=thr});var cft=b((Rro,lft)=>{"use strict";var l_e=Object.defineProperty,ihr=Object.getOwnPropertyDescriptor,ahr=Object.getOwnPropertyNames,shr=Object.prototype.hasOwnProperty,uhr=(t,e)=>{for(var r in e)l_e(t,r,{get:e[r],enumerable:!0})},lhr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ahr(e))!shr.call(t,o)&&o!==r&&l_e(t,o,{get:()=>e[o],enumerable:!(n=ihr(e,o))||n.enumerable});return t},chr=t=>lhr(l_e({},"__esModule",{value:!0}),t),c_e=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Ba=(t,e,r)=>(c_e(t,e,"read from private field"),r?r.call(t):e.get(t)),Ab=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},h4=(t,e,r,n)=>(c_e(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),s_e=(t,e,r)=>(c_e(t,e,"access private method"),r),oft={};uhr(oft,{FormDataEncoder:()=>bhr,isFile:()=>wI,isFormData:()=>sft});lft.exports=chr(oft);var Yx=t=>typeof t=="function",dhr=t=>Yx(t[Symbol.asyncIterator]),Zdt=65536;function*ift(t){if(t.byteLength<=Zdt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,Zdt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*fhr(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*Qdt(t){for await(let e of t)yield*ift(e)}var phr=t=>{if(dhr(t))return Qdt(t);if(Yx(t.getReader))return Qdt(fhr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},eft="abcdefghijklmnopqrstuvwxyz0123456789";function hhr(){let t=16,e="";for(;t--;)e+=eft[Math.random()*eft.length<<0];return e}var aft=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),mhr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function tft(t){if(mhr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function rft(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var ghr=t=>new Proxy(t,{get:(e,r)=>rft(e,r),has:(e,r)=>rft(e,r)!==void 0}),sft=t=>Boolean(t&&Yx(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&Yx(t.append)&&Yx(t.getAll)&&Yx(t.entries)&&Yx(t[Symbol.iterator])),nft=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),wI=t=>Boolean(t&&typeof t=="object"&&Yx(t.constructor)&&t[Symbol.toStringTag]==="File"&&Yx(t.stream)&&t.name!=null),yhr={enableAdditionalHeaders:!1},SY={writable:!1,configurable:!1},IP,m4,xY,g4,vI,y4,b4,CY,OY,d_e,u_e,uft,bhr=class{constructor(t,e,r){if(Ab(this,OY),Ab(this,u_e),Ab(this,IP,`\r
`),Ab(this,m4,void 0),Ab(this,xY,void 0),Ab(this,g4,"-".repeat(2)),Ab(this,vI,new TextEncoder),Ab(this,y4,void 0),Ab(this,b4,void 0),Ab(this,CY,void 0),!sft(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(tft(e)?r=e:n=e,n||(n=hhr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!tft(r))throw new TypeError("Expected options argument to be an object.");h4(this,b4,Array.from(t.entries())),h4(this,CY,{...yhr,...r}),h4(this,m4,Ba(this,vI).encode(Ba(this,IP))),h4(this,xY,Ba(this,m4).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,h4(this,y4,Ba(this,vI).encode(`${Ba(this,g4)}${this.boundary}${Ba(this,g4)}${Ba(this,IP).repeat(2)}`));let o={"Content-Type":this.contentType},i=s_e(this,u_e,uft).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=ghr(Object.freeze(o)),Object.defineProperties(this,{boundary:SY,contentType:SY,contentLength:SY,headers:SY})}*values(){for(let[t,e]of Ba(this,b4)){let r=wI(e)?e:Ba(this,vI).encode(aft(e));yield s_e(this,OY,d_e).call(this,t,r),yield r,yield Ba(this,m4)}yield Ba(this,y4)}async*encode(){for(let t of this.values())wI(t)?yield*phr(t.stream()):yield*ift(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};IP=new WeakMap;m4=new WeakMap;xY=new WeakMap;g4=new WeakMap;vI=new WeakMap;y4=new WeakMap;b4=new WeakMap;CY=new WeakMap;OY=new WeakSet;d_e=function(t,e){let r="";if(r+=`${Ba(this,g4)}${this.boundary}${Ba(this,IP)}`,r+=`Content-Disposition: form-data; name="${nft(t)}"`,wI(e)&&(r+=`; filename="${nft(e.name)}"${Ba(this,IP)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Ba(this,CY).enableAdditionalHeaders===!0){let n=wI(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Ba(this,IP)}Content-Length: ${n}`)}return Ba(this,vI).encode(`${r}${Ba(this,IP).repeat(2)}`)};u_e=new WeakSet;uft=function(){let t=0;for(let[e,r]of Ba(this,b4)){let n=wI(r)?r:Ba(this,vI).encode(aft(r)),o=wI(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=s_e(this,OY,d_e).call(this,e,n).byteLength,t+=o,t+=Ba(this,xY)}return String(t+Ba(this,y4).byteLength)}});var fft=b((Dro,dft)=>{dft.exports=typeof self=="object"?self.FormData:window.FormData});var pft=b(Tl=>{"use strict";var _hr=Tl&&Tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vhr=Tl&&Tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bF=Tl&&Tl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_hr(e,t,r);return vhr(e,t),e},DP=Tl&&Tl.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Tl,"__esModule",{value:!0});Tl.WebFormData=Tl.Node16FormData=Tl.Node18FormData=Tl.newFormData=void 0;var EY=sF();function f_e(t){return typeof t=="object"&&t!=null&&"name"in t}function whr(){return DP(this,void 0,void 0,function*(){let t;return EY.RUNTIME.type==="node"&&EY.RUNTIME.parsedVersion!=null&&EY.RUNTIME.parsedVersion>=18?t=new PY:EY.RUNTIME.type==="node"?t=new TY:t=new MY,yield t.setup(),t})}Tl.newFormData=whr;var PY=class{setup(){return DP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>bF(Xdt()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return DP(this,void 0,void 0,function*(){n==null&&f_e(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>bF(r4()))).Readable?(o=this.fd)===null||o===void 0||o.append(e,{type:void 0,name:n,[Symbol.toStringTag]:"File",stream(){return r}}):(i=this.fd)===null||i===void 0||i.append(e,r,n)})}getRequest(){return DP(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>bF(cft()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>bF(r4()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Tl.Node18FormData=PY;var TY=class{setup(){return DP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>bF(fft()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return DP(this,void 0,void 0,function*(){n==null&&f_e(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>bF(r4()))).Readable?a=r:a=Buffer.from(yield r.arrayBuffer()),n==null?(o=this.fd)===null||o===void 0||o.append(e,a):(i=this.fd)===null||i===void 0||i.append(e,a,{filename:n})})}getRequest(){return{body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}};Tl.Node16FormData=TY;var MY=class{setup(){return DP(this,void 0,void 0,function*(){this.fd=new FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o;return DP(this,void 0,void 0,function*(){n==null&&f_e(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Tl.WebFormData=MY});var hft=b(SI=>{"use strict";var Shr=SI&&SI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xhr=SI&&SI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Shr(e,t,r)};Object.defineProperty(SI,"__esModule",{value:!0});xhr(pft(),SI)});var uc=b(AY=>{"use strict";Object.defineProperty(AY,"__esModule",{value:!0});AY.SchemaType=void 0;AY.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 Ef=b(RY=>{"use strict";Object.defineProperty(RY,"__esModule",{value:!0});RY.getErrorMessageForIncorrectType=void 0;function Chr(t,e){return`Expected ${e}. Received ${Ohr(t)}.`}RY.getErrorMessageForIncorrectType=Chr;function Ohr(t){if(Array.isArray(t))return"list";if(t===null)return"null";switch(typeof t){case"string":return`"${t}"`;case"number":case"boolean":case"undefined":return`${t}`}return typeof t}});var Xx=b(IY=>{"use strict";Object.defineProperty(IY,"__esModule",{value:!0});IY.maybeSkipValidation=void 0;function Ehr(t){return Object.assign(Object.assign({},t),{json:mft(t.json),parse:mft(t.parse)})}IY.maybeSkipValidation=Ehr;function mft(t){return(e,r)=>{let n=t(e,r),{skipValidation:o=!1}=r??{};return!n.ok&&o?(console.warn(["Failed to validate.",...n.errors.map(i=>" - "+(i.path.length>0?`${i.path.join(".")}: ${i.message}`:i.message))].join(`
`)),{ok:!0,value:e}):n}}});var p_e=b(DY=>{"use strict";Object.defineProperty(DY,"__esModule",{value:!0});DY.stringifyValidationError=void 0;function Phr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}DY.stringifyValidationError=Phr});var h_e=b(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.JsonError=void 0;var Thr=p_e(),_4=class extends Error{constructor(e){super(e.map(Thr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,_4.prototype)}};jY.JsonError=_4});var m_e=b(NY=>{"use strict";Object.defineProperty(NY,"__esModule",{value:!0});NY.ParseError=void 0;var Mhr=p_e(),v4=class extends Error{constructor(e){super(e.map(Mhr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,v4.prototype)}};NY.ParseError=v4});var bft=b(jP=>{"use strict";Object.defineProperty(jP,"__esModule",{value:!0});jP.transform=jP.optional=jP.getSchemaUtils=void 0;var Ahr=uc(),Rhr=h_e(),Ihr=m_e();function g_e(t){return{optional:()=>gft(t),transform:e=>yft(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new Ihr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new Rhr.JsonError(n.errors)}}}jP.getSchemaUtils=g_e;function gft(t){let e={parse:(r,n)=>r==null?{ok:!0,value:void 0}:t.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:t.json(r,n),getType:()=>Ahr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),g_e(e))}jP.optional=gft;function yft(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);return i.ok?{ok:!0,value:e.transform(i.value)}:i},json:(n,o)=>{let i=e.untransform(n);return t.json(i,o)},getType:()=>t.getType()};return Object.assign(Object.assign({},r),g_e(r))}jP.transform=yft});var Sp=b($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.ParseError=$h.JsonError=$h.transform=$h.optional=$h.getSchemaUtils=void 0;var y_e=bft();Object.defineProperty($h,"getSchemaUtils",{enumerable:!0,get:function(){return y_e.getSchemaUtils}});Object.defineProperty($h,"optional",{enumerable:!0,get:function(){return y_e.optional}});Object.defineProperty($h,"transform",{enumerable:!0,get:function(){return y_e.transform}});var Dhr=h_e();Object.defineProperty($h,"JsonError",{enumerable:!0,get:function(){return Dhr.JsonError}});var jhr=m_e();Object.defineProperty($h,"ParseError",{enumerable:!0,get:function(){return jhr.ParseError}})});var _ft=b(LY=>{"use strict";Object.defineProperty(LY,"__esModule",{value:!0});LY.date=void 0;var Nhr=uc(),b_e=Ef(),Lhr=Xx(),Fhr=Sp(),khr=/^([+-]?\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 Bhr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,b_e.getErrorMessageForIncorrectType)(e,"string")}]}:khr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,b_e.getErrorMessageForIncorrectType)(e,"ISO 8601 date string")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>e instanceof Date?{ok:!0,value:e.toISOString()}:{ok:!1,errors:[{path:r,message:(0,b_e.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>Nhr.SchemaType.DATE};return Object.assign(Object.assign({},(0,Lhr.maybeSkipValidation)(t)),(0,Fhr.getSchemaUtils)(t))}LY.date=Bhr});var vft=b(FY=>{"use strict";Object.defineProperty(FY,"__esModule",{value:!0});FY.date=void 0;var $hr=_ft();Object.defineProperty(FY,"date",{enumerable:!0,get:function(){return $hr.date}})});var Zx=b(kY=>{"use strict";Object.defineProperty(kY,"__esModule",{value:!0});kY.createIdentitySchemaCreator=void 0;var qhr=Sp(),Uhr=Xx();function zhr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,Uhr.maybeSkipValidation)(r)),(0,qhr.getSchemaUtils)(r))}}kY.createIdentitySchemaCreator=zhr});var Sft=b(BY=>{"use strict";Object.defineProperty(BY,"__esModule",{value:!0});BY.enum_=void 0;var Hhr=uc(),Vhr=Zx(),wft=Ef();function Whr(t){let e=new Set(t);return(0,Vhr.createIdentitySchemaCreator)(Hhr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,wft.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,wft.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}BY.enum_=Whr});var __e=b($Y=>{"use strict";Object.defineProperty($Y,"__esModule",{value:!0});$Y.enum_=void 0;var Jhr=Sft();Object.defineProperty($Y,"enum_",{enumerable:!0,get:function(){return Jhr.enum_}})});var v_e=b(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});NP.getMemoizedSchema=NP.constructLazyBaseSchema=NP.lazy=void 0;var Ghr=Sp();function Khr(t){let e=xft(t);return Object.assign(Object.assign({},e),(0,Ghr.getSchemaUtils)(e))}NP.lazy=Khr;function xft(t){return{parse:(e,r)=>qY(t).parse(e,r),json:(e,r)=>qY(t).json(e,r),getType:()=>qY(t).getType()}}NP.constructLazyBaseSchema=xft;function qY(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}NP.getMemoizedSchema=qY});var w_e=b(UY=>{"use strict";Object.defineProperty(UY,"__esModule",{value:!0});UY.entries=void 0;function Yhr(t){return Object.entries(t)}UY.entries=Yhr});var S_e=b(zY=>{"use strict";Object.defineProperty(zY,"__esModule",{value:!0});zY.filterObject=void 0;function Xhr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}zY.filterObject=Xhr});var w4=b(HY=>{"use strict";Object.defineProperty(HY,"__esModule",{value:!0});HY.isPlainObject=void 0;function Zhr(t){if(typeof t!="object"||t===null)return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}HY.isPlainObject=Zhr});var x_e=b(VY=>{"use strict";Object.defineProperty(VY,"__esModule",{value:!0});VY.keys=void 0;function Qhr(t){return Object.keys(t)}VY.keys=Qhr});var Cft=b(WY=>{"use strict";Object.defineProperty(WY,"__esModule",{value:!0});WY.partition=void 0;function emr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}WY.partition=emr});var Pft=b(_F=>{"use strict";Object.defineProperty(_F,"__esModule",{value:!0});_F.withParsedProperties=_F.getObjectLikeUtils=void 0;var tmr=S_e(),rmr=Ef(),nmr=w4(),omr=Sp();function Oft(t){return{withParsedProperties:e=>Eft(t,e)}}_F.getObjectLikeUtils=Oft;function Eft(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);if(!i.ok)return i;let a=Object.entries(e).reduce((s,[u,l])=>Object.assign(Object.assign({},s),{[u]:typeof l=="function"?l(i.value):l}),{});return{ok:!0,value:Object.assign(Object.assign({},i.value),a)}},json:(n,o)=>{var i;if(!(0,nmr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,rmr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,tmr.filterObject)(n,Object.keys(n).filter(u=>!a.has(u)));return t.json(s,o)},getType:()=>t.getType()};return Object.assign(Object.assign(Object.assign({},r),(0,omr.getSchemaUtils)(r)),Oft(r))}_F.withParsedProperties=Eft});var S4=b(vF=>{"use strict";Object.defineProperty(vF,"__esModule",{value:!0});vF.withParsedProperties=vF.getObjectLikeUtils=void 0;var Tft=Pft();Object.defineProperty(vF,"getObjectLikeUtils",{enumerable:!0,get:function(){return Tft.getObjectLikeUtils}});Object.defineProperty(vF,"withParsedProperties",{enumerable:!0,get:function(){return Tft.withParsedProperties}})});var C_e=b(wF=>{"use strict";Object.defineProperty(wF,"__esModule",{value:!0});wF.isProperty=wF.property=void 0;function imr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}wF.property=imr;function amr(t){return t.isProperty}wF.isProperty=amr});var E_e=b(SF=>{"use strict";Object.defineProperty(SF,"__esModule",{value:!0});SF.getObjectUtils=SF.object=void 0;var C4=uc(),Mft=w_e(),Aft=S_e(),smr=Ef(),umr=w4(),jft=x_e(),lmr=Xx(),cmr=Cft(),Nft=S4(),Lft=Sp(),x4=C_e();function dmr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,x4.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,jft.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,Mft.entries)(t)){let u=(0,x4.isProperty)(s)?s.rawKey:a,l=(0,x4.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,Dft(l)&&i.push(u)}return Rft({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,Mft.entries)(t)){let s=(0,x4.isProperty)(a)?a.valueSchema:a;Dft(s)&&o.push(i)}return Rft({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,x4.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:()=>C4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,lmr.maybeSkipValidation)(e)),(0,Lft.getSchemaUtils)(e)),(0,Nft.getObjectLikeUtils)(e)),O_e(e))}SF.object=dmr;function Rft({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,umr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,smr.getErrorMessageForIncorrectType)(t,"object")}]};let a=new Set(e),s=[],u={};for(let[l,c]of Object.entries(t)){let d=r(l);if(d!=null){a.delete(l);let f=d.transform(c);f.ok?u[d.transformedKey]=f.value:(u[l]=c,s.push(...f.errors))}else switch(n){case"fail":s.push({path:[...i,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=c;break}}return s.push(...e.filter(l=>a.has(l)).map(l=>({path:i,message:`Missing required key "${l}"`}))),s.length===0||o?{ok:!0,value:u}:{ok:!1,errors:s}}function O_e(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>Ift({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>Ift({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>C4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,Lft.getSchemaUtils)(r)),(0,Nft.getObjectLikeUtils)(r)),O_e(r))}}}SF.getObjectUtils=O_e;function Ift({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,cmr.partition)((0,jft.keys)(e),l=>o.has(l)),s=r((0,Aft.filterObject)(e,a)),u=n((0,Aft.filterObject)(e,i));return s.ok&&u.ok?{ok:!0,value:Object.assign(Object.assign({},s.value),u.value)}:{ok:!1,errors:[...s.ok?[]:s.errors,...u.ok?[]:u.errors]}}function Dft(t){return!fmr(t)}function fmr(t){switch(t.getType()){case C4.SchemaType.ANY:case C4.SchemaType.UNKNOWN:case C4.SchemaType.OPTIONAL:return!0;default:return!1}}});var Fft=b(JY=>{"use strict";Object.defineProperty(JY,"__esModule",{value:!0});JY.objectWithoutOptionalProperties=void 0;var pmr=E_e();function hmr(t){return(0,pmr.object)(t)}JY.objectWithoutOptionalProperties=hmr});var P_e=b(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.property=qh.isProperty=qh.objectWithoutOptionalProperties=qh.object=qh.getObjectUtils=void 0;var kft=E_e();Object.defineProperty(qh,"getObjectUtils",{enumerable:!0,get:function(){return kft.getObjectUtils}});Object.defineProperty(qh,"object",{enumerable:!0,get:function(){return kft.object}});var mmr=Fft();Object.defineProperty(qh,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return mmr.objectWithoutOptionalProperties}});var Bft=C_e();Object.defineProperty(qh,"isProperty",{enumerable:!0,get:function(){return Bft.isProperty}});Object.defineProperty(qh,"property",{enumerable:!0,get:function(){return Bft.property}})});var $ft=b(GY=>{"use strict";Object.defineProperty(GY,"__esModule",{value:!0});GY.lazyObject=void 0;var gmr=P_e(),ymr=S4(),bmr=Sp(),T_e=v_e();function _mr(t){let e=Object.assign(Object.assign({},(0,T_e.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,T_e.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,T_e.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,bmr.getSchemaUtils)(e)),(0,ymr.getObjectLikeUtils)(e)),(0,gmr.getObjectUtils)(e))}GY.lazyObject=_mr});var qft=b(xF=>{"use strict";Object.defineProperty(xF,"__esModule",{value:!0});xF.lazyObject=xF.lazy=void 0;var vmr=v_e();Object.defineProperty(xF,"lazy",{enumerable:!0,get:function(){return vmr.lazy}});var wmr=$ft();Object.defineProperty(xF,"lazyObject",{enumerable:!0,get:function(){return wmr.lazyObject}})});var zft=b(KY=>{"use strict";Object.defineProperty(KY,"__esModule",{value:!0});KY.list=void 0;var Smr=uc(),xmr=Ef(),Cmr=Xx(),Omr=Sp();function Emr(t){let e={parse:(r,n)=>Uft(r,(o,i)=>{var a;return t.parse(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),json:(r,n)=>Uft(r,(o,i)=>{var a;return t.json(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),getType:()=>Smr.SchemaType.LIST};return Object.assign(Object.assign({},(0,Cmr.maybeSkipValidation)(e)),(0,Omr.getSchemaUtils)(e))}KY.list=Emr;function Uft(t,e){return Array.isArray(t)?t.map((n,o)=>e(n,o)).reduce((n,o)=>{if(n.ok&&o.ok)return{ok:!0,value:[...n.value,o.value]};let i=[];return n.ok||i.push(...n.errors),o.ok||i.push(...o.errors),{ok:!1,errors:i}},{ok:!0,value:[]}):{ok:!1,errors:[{message:(0,xmr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var M_e=b(YY=>{"use strict";Object.defineProperty(YY,"__esModule",{value:!0});YY.list=void 0;var Pmr=zft();Object.defineProperty(YY,"list",{enumerable:!0,get:function(){return Pmr.list}})});var Hft=b(XY=>{"use strict";Object.defineProperty(XY,"__esModule",{value:!0});XY.stringLiteral=void 0;var Tmr=uc(),Mmr=Zx(),Amr=Ef();function Rmr(t){return(0,Mmr.createIdentitySchemaCreator)(Tmr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Amr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}XY.stringLiteral=Rmr});var Vft=b(ZY=>{"use strict";Object.defineProperty(ZY,"__esModule",{value:!0});ZY.booleanLiteral=void 0;var Imr=uc(),Dmr=Zx(),jmr=Ef();function Nmr(t){return(0,Dmr.createIdentitySchemaCreator)(Imr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,jmr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}ZY.booleanLiteral=Nmr});var Wft=b(CF=>{"use strict";Object.defineProperty(CF,"__esModule",{value:!0});CF.booleanLiteral=CF.stringLiteral=void 0;var Lmr=Hft();Object.defineProperty(CF,"stringLiteral",{enumerable:!0,get:function(){return Lmr.stringLiteral}});var Fmr=Vft();Object.defineProperty(CF,"booleanLiteral",{enumerable:!0,get:function(){return Fmr.booleanLiteral}})});var Jft=b(QY=>{"use strict";Object.defineProperty(QY,"__esModule",{value:!0});QY.any=void 0;var kmr=uc(),Bmr=Zx();QY.any=(0,Bmr.createIdentitySchemaCreator)(kmr.SchemaType.ANY,t=>({ok:!0,value:t}))});var Gft=b(eX=>{"use strict";Object.defineProperty(eX,"__esModule",{value:!0});eX.boolean=void 0;var $mr=uc(),qmr=Zx(),Umr=Ef();eX.boolean=(0,qmr.createIdentitySchemaCreator)($mr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Umr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var Kft=b(tX=>{"use strict";Object.defineProperty(tX,"__esModule",{value:!0});tX.number=void 0;var zmr=uc(),Hmr=Zx(),Vmr=Ef();tX.number=(0,Hmr.createIdentitySchemaCreator)(zmr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Vmr.getErrorMessageForIncorrectType)(t,"number")}]})});var Yft=b(rX=>{"use strict";Object.defineProperty(rX,"__esModule",{value:!0});rX.string=void 0;var Wmr=uc(),Jmr=Zx(),Gmr=Ef();rX.string=(0,Jmr.createIdentitySchemaCreator)(Wmr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Gmr.getErrorMessageForIncorrectType)(t,"string")}]})});var Xft=b(nX=>{"use strict";Object.defineProperty(nX,"__esModule",{value:!0});nX.unknown=void 0;var Kmr=uc(),Ymr=Zx();nX.unknown=(0,Ymr.createIdentitySchemaCreator)(Kmr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var Zft=b(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.unknown=Uh.string=Uh.number=Uh.boolean=Uh.any=void 0;var Xmr=Jft();Object.defineProperty(Uh,"any",{enumerable:!0,get:function(){return Xmr.any}});var Zmr=Gft();Object.defineProperty(Uh,"boolean",{enumerable:!0,get:function(){return Zmr.boolean}});var Qmr=Kft();Object.defineProperty(Uh,"number",{enumerable:!0,get:function(){return Qmr.number}});var egr=Yft();Object.defineProperty(Uh,"string",{enumerable:!0,get:function(){return egr.string}});var tgr=Xft();Object.defineProperty(Uh,"unknown",{enumerable:!0,get:function(){return tgr.unknown}})});var ept=b(oX=>{"use strict";Object.defineProperty(oX,"__esModule",{value:!0});oX.record=void 0;var A_e=uc(),rgr=w_e(),ngr=Ef(),ogr=w4(),igr=Xx(),agr=Sp();function sgr(t,e){let r={parse:(n,o)=>Qft({value:n,isKeyNumeric:t.getType()===A_e.SchemaType.NUMBER,transformKey:i=>{var a;return t.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(n,o)=>Qft({value:n,isKeyNumeric:t.getType()===A_e.SchemaType.NUMBER,transformKey:i=>{var a;return t.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>A_e.SchemaType.RECORD};return Object.assign(Object.assign({},(0,igr.maybeSkipValidation)(r)),(0,agr.getSchemaUtils)(r))}oX.record=sgr;function Qft({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,ogr.isPlainObject)(t)?(0,rgr.entries)(t).reduce((i,[a,s])=>{if(s==null)return i;let u=i,l=a;if(e){let p=a.length>0?Number(a):NaN;isNaN(p)||(l=p)}let c=r(l),d=n(s,l);if(u.ok&&c.ok&&d.ok)return{ok:!0,value:Object.assign(Object.assign({},u.value),{[c.value]:d.value})};let f=[];return u.ok||f.push(...u.errors),c.ok||f.push(...c.errors),d.ok||f.push(...d.errors),{ok:!1,errors:f}},{ok:!0,value:{}}):{ok:!1,errors:[{path:o,message:(0,ngr.getErrorMessageForIncorrectType)(t,"object")}]}}});var tpt=b(iX=>{"use strict";Object.defineProperty(iX,"__esModule",{value:!0});iX.record=void 0;var ugr=ept();Object.defineProperty(iX,"record",{enumerable:!0,get:function(){return ugr.record}})});var rpt=b(aX=>{"use strict";Object.defineProperty(aX,"__esModule",{value:!0});aX.set=void 0;var lgr=uc(),cgr=Ef(),dgr=Xx(),fgr=M_e(),pgr=Sp();function hgr(t){let e=(0,fgr.list)(t),r={parse:(n,o)=>{let i=e.parse(n,o);return i.ok?{ok:!0,value:new Set(i.value)}:i},json:(n,o)=>{var i;return n instanceof Set?e.json([...n],o):{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,cgr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>lgr.SchemaType.SET};return Object.assign(Object.assign({},(0,dgr.maybeSkipValidation)(r)),(0,pgr.getSchemaUtils)(r))}aX.set=hgr});var npt=b(sX=>{"use strict";Object.defineProperty(sX,"__esModule",{value:!0});sX.set=void 0;var mgr=rpt();Object.defineProperty(sX,"set",{enumerable:!0,get:function(){return mgr.set}})});var ipt=b(uX=>{"use strict";Object.defineProperty(uX,"__esModule",{value:!0});uX.undiscriminatedUnion=void 0;var ggr=uc(),ygr=Xx(),bgr=Sp();function _gr(t){let e={parse:(r,n)=>opt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>opt((o,i)=>o.json(r,i),t,n),getType:()=>ggr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,ygr.maybeSkipValidation)(e)),(0,bgr.getSchemaUtils)(e))}uX.undiscriminatedUnion=_gr;function opt(t,e,r){let n=[];for(let[o,i]of e.entries()){let a=t(i,Object.assign(Object.assign({},r),{skipValidation:!1}));if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${o}] ${s.message}`})}return{ok:!1,errors:n}}});var apt=b(lX=>{"use strict";Object.defineProperty(lX,"__esModule",{value:!0});lX.undiscriminatedUnion=void 0;var vgr=ipt();Object.defineProperty(lX,"undiscriminatedUnion",{enumerable:!0,get:function(){return vgr.undiscriminatedUnion}})});var spt=b(cX=>{"use strict";Object.defineProperty(cX,"__esModule",{value:!0});cX.discriminant=void 0;function wgr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}cX.discriminant=wgr});var lpt=b(OF=>{"use strict";var Sgr=OF&&OF.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(OF,"__esModule",{value:!0});OF.union=void 0;var xgr=uc(),Cgr=Ef(),Ogr=w4(),Egr=x_e(),Pgr=Xx(),Tgr=__e(),Mgr=S4(),Agr=Sp();function Rgr(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,Tgr.enum_)((0,Egr.keys)(e)),i={parse:(a,s)=>upt({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>{var l;return o.parse(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],r]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.parse(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>upt({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>{var l;return o.json(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],n]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.json(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>xgr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,Pgr.maybeSkipValidation)(i)),(0,Agr.getSchemaUtils)(i)),(0,Mgr.getObjectLikeUtils)(i))}OF.union=Rgr;function upt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,Ogr.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,Cgr.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=Sgr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let h=a(d,p);return h.ok?{ok:!0,value:Object.assign({[r]:c},h.value)}:h}});var cpt=b(EF=>{"use strict";Object.defineProperty(EF,"__esModule",{value:!0});EF.union=EF.discriminant=void 0;var Igr=spt();Object.defineProperty(EF,"discriminant",{enumerable:!0,get:function(){return Igr.discriminant}});var Dgr=lpt();Object.defineProperty(EF,"union",{enumerable:!0,get:function(){return Dgr.union}})});var dpt=b(tl=>{"use strict";var jgr=tl&&tl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xp=tl&&tl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jgr(e,t,r)};Object.defineProperty(tl,"__esModule",{value:!0});xp(vft(),tl);xp(__e(),tl);xp(qft(),tl);xp(M_e(),tl);xp(Wft(),tl);xp(P_e(),tl);xp(S4(),tl);xp(Zft(),tl);xp(tpt(),tl);xp(Sp(),tl);xp(npt(),tl);xp(apt(),tl);xp(cpt(),tl)});var fpt=b(xI=>{"use strict";var Ngr=xI&&xI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lgr=xI&&xI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ngr(e,t,r)};Object.defineProperty(xI,"__esModule",{value:!0});Lgr(dpt(),xI)});var $=b(lc=>{"use strict";var ppt=lc&&lc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fgr=lc&&lc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O4=lc&&lc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ppt(e,t,r)},kgr=lc&&lc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ppt(e,t,r);return Fgr(e,t),e};Object.defineProperty(lc,"__esModule",{value:!0});lc.serialization=void 0;O4(kdt(),lc);O4(zdt(),lc);O4(Gdt(),lc);O4(sF(),lc);O4(hft(),lc);lc.serialization=kgr(fpt())});var mpt=b(ws=>{"use strict";var E4=ws&&ws.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},P4=ws&&ws.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},Wi=ws&&ws.__await||function(t){return this instanceof Wi?(this.v=t,this):new Wi(t)},T4=ws&&ws.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Wi?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(ws,"__esModule",{value:!0});ws.readableStreamAsyncIterable=ws._decodeChunks=ws.LineDecoder=ws._iterSSEMessages=ws.StreamUtils=void 0;var PF=rs(),LP=class{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return T4(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=P4(hpt(e,r)),c;c=yield Wi(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 PF.CohereError({message:`Error: ${f.error}`});yield yield Wi(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 PF.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Wi({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Wi(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Wi(void 0);throw d}finally{u||r?.abort()}})}return new LP(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return T4(this,arguments,function*(){var s,u;let l=new Cg,c=I_e(e);try{for(var d=P4(c),f;f=yield Wi(d.next()),!f.done;){let p=f.value;for(let h of l.decode(p))yield yield Wi(h)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Wi(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Wi(p)})}function i(){return T4(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=P4(o()),d;d=yield Wi(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Wi(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Wi(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Wi(void 0);throw f}finally{l||r?.abort()}})}return new LP(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new LP(()=>o(e),this.controller),new LP(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new ReadableStream({start(){return E4(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return E4(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 E4(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};ws.StreamUtils=LP;function hpt(t,e){return T4(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new PF.CohereError({message:"Attempted to iterate over a response with no body"});let i=new R_e,a=new Cg,s=I_e(t.body);try{for(var u=P4(Bgr(s)),l;l=yield Wi(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Wi(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Wi(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Wi(d))}})}ws._iterSSEMessages=hpt;function Bgr(t){return T4(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=P4(t),a;a=yield Wi(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=$gr(o))!==-1;)yield yield Wi(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Wi(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Wi(o))})}function $gr(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var R_e=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=Ugr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},Cg=class{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=Cg.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(Cg.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){var r;if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new PF.CohereError({message:`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`})}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return(r=this.textDecoder)!==null&&r!==void 0||(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new PF.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new PF.CohereError({message:"Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error."})}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};ws.LineDecoder=Cg;Cg.NEWLINE_CHARS=new Set([`
`,"\r"]);Cg.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function qgr(t){let e=new Cg,r=[];for(let n of t)r.push(...e.decode(n));return r}ws._decodeChunks=qgr;function Ugr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function I_e(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return E4(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return E4(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}ws.readableStreamAsyncIterable=I_e});var D_e=b(Rb=>{"use strict";var zgr=Rb&&Rb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hgr=Rb&&Rb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vgr=Rb&&Rb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zgr(e,t,r);return Hgr(e,t),e};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.V2ChatStreamRequestCitationMode=void 0;var Wgr=Vgr($());Rb.V2ChatStreamRequestCitationMode=Wgr.serialization.enum_(["FAST","ACCURATE","OFF"])});var j_e=b(Ib=>{"use strict";var Jgr=Ib&&Ib.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ggr=Ib&&Ib.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kgr=Ib&&Ib.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jgr(e,t,r);return Ggr(e,t),e};Object.defineProperty(Ib,"__esModule",{value:!0});Ib.V2ChatRequestCitationMode=void 0;var Ygr=Kgr($());Ib.V2ChatRequestCitationMode=Ygr.serialization.enum_(["FAST","ACCURATE","OFF"])});var TF=b(Db=>{"use strict";var Xgr=Db&&Db.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zgr=Db&&Db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qgr=Db&&Db.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xgr(e,t,r);return Zgr(e,t),e};Object.defineProperty(Db,"__esModule",{value:!0});Db.TextContent=void 0;var gpt=Qgr($());Db.TextContent=gpt.serialization.object({text:gpt.serialization.string()})});var N_e=b(jb=>{"use strict";var eyr=jb&&jb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tyr=jb&&jb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ryr=jb&&jb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eyr(e,t,r);return tyr(e,t),e};Object.defineProperty(jb,"__esModule",{value:!0});jb.Content=void 0;var nyr=ryr($()),oyr=TF();jb.Content=nyr.serialization.union("type",{text:oyr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var F_e=b(Nb=>{"use strict";var iyr=Nb&&Nb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ayr=Nb&&Nb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),syr=Nb&&Nb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iyr(e,t,r);return ayr(e,t),e};Object.defineProperty(Nb,"__esModule",{value:!0});Nb.UserMessageContent=void 0;var L_e=syr($()),uyr=N_e();Nb.UserMessageContent=L_e.serialization.undiscriminatedUnion([L_e.serialization.string(),L_e.serialization.list(uyr.Content)])});var CI=b(Lb=>{"use strict";var lyr=Lb&&Lb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cyr=Lb&&Lb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dyr=Lb&&Lb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lyr(e,t,r);return cyr(e,t),e};Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ChatDocument=void 0;var k_e=dyr($());Lb.ChatDocument=k_e.serialization.record(k_e.serialization.string(),k_e.serialization.string())});var B_e=b(Fb=>{"use strict";var fyr=Fb&&Fb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pyr=Fb&&Fb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hyr=Fb&&Fb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fyr(e,t,r);return pyr(e,t),e};Object.defineProperty(Fb,"__esModule",{value:!0});Fb.UserMessage=void 0;var ypt=hyr($()),myr=F_e(),gyr=CI();Fb.UserMessage=ypt.serialization.object({content:myr.UserMessageContent,documents:ypt.serialization.list(gyr.ChatDocument).optional()})});var q_e=b(kb=>{"use strict";var yyr=kb&&kb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),byr=kb&&kb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_yr=kb&&kb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yyr(e,t,r);return byr(e,t),e};Object.defineProperty(kb,"__esModule",{value:!0});kb.ToolCall2Function=void 0;var $_e=_yr($());kb.ToolCall2Function=$_e.serialization.object({name:$_e.serialization.string().optional(),arguments:$_e.serialization.string().optional()})});var dX=b(Bb=>{"use strict";var vyr=Bb&&Bb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wyr=Bb&&Bb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Syr=Bb&&Bb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vyr(e,t,r);return wyr(e,t),e};Object.defineProperty(Bb,"__esModule",{value:!0});Bb.ToolCall2=void 0;var U_e=Syr($()),xyr=q_e();Bb.ToolCall2=U_e.serialization.object({id:U_e.serialization.string().optional(),type:U_e.serialization.stringLiteral("function").optional(),function:xyr.ToolCall2Function.optional()})});var z_e=b($b=>{"use strict";var Cyr=$b&&$b.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oyr=$b&&$b.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eyr=$b&&$b.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cyr(e,t,r);return Oyr(e,t),e};Object.defineProperty($b,"__esModule",{value:!0});$b.ToolSource=void 0;var MF=Eyr($());$b.ToolSource=MF.serialization.object({id:MF.serialization.string().optional(),toolOutput:MF.serialization.property("tool_output",MF.serialization.record(MF.serialization.string(),MF.serialization.unknown()).optional())})});var H_e=b(qb=>{"use strict";var Pyr=qb&&qb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tyr=qb&&qb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Myr=qb&&qb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pyr(e,t,r);return Tyr(e,t),e};Object.defineProperty(qb,"__esModule",{value:!0});qb.DocumentSource=void 0;var M4=Myr($());qb.DocumentSource=M4.serialization.object({id:M4.serialization.string().optional(),document:M4.serialization.record(M4.serialization.string(),M4.serialization.unknown()).optional()})});var V_e=b(Ub=>{"use strict";var Ayr=Ub&&Ub.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ryr=Ub&&Ub.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iyr=Ub&&Ub.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ayr(e,t,r);return Ryr(e,t),e};Object.defineProperty(Ub,"__esModule",{value:!0});Ub.Source=void 0;var Dyr=Iyr($()),jyr=z_e(),Nyr=H_e();Ub.Source=Dyr.serialization.union("type",{tool:jyr.ToolSource,document:Nyr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var R4=b(zb=>{"use strict";var Lyr=zb&&zb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fyr=zb&&zb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kyr=zb&&zb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lyr(e,t,r);return Fyr(e,t),e};Object.defineProperty(zb,"__esModule",{value:!0});zb.Citation=void 0;var A4=kyr($()),Byr=V_e();zb.Citation=A4.serialization.object({start:A4.serialization.number().optional(),end:A4.serialization.number().optional(),text:A4.serialization.string().optional(),sources:A4.serialization.list(Byr.Source).optional()})});var W_e=b(Hb=>{"use strict";var $yr=Hb&&Hb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qyr=Hb&&Hb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uyr=Hb&&Hb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$yr(e,t,r);return qyr(e,t),e};Object.defineProperty(Hb,"__esModule",{value:!0});Hb.AssistantMessageContentItem=void 0;var zyr=Uyr($()),Hyr=TF();Hb.AssistantMessageContentItem=zyr.serialization.union("type",{text:Hyr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var G_e=b(Vb=>{"use strict";var Vyr=Vb&&Vb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wyr=Vb&&Vb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jyr=Vb&&Vb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vyr(e,t,r);return Wyr(e,t),e};Object.defineProperty(Vb,"__esModule",{value:!0});Vb.AssistantMessageContent=void 0;var J_e=Jyr($()),Gyr=W_e();Vb.AssistantMessageContent=J_e.serialization.undiscriminatedUnion([J_e.serialization.string(),J_e.serialization.list(Gyr.AssistantMessageContentItem)])});var K_e=b(Wb=>{"use strict";var Kyr=Wb&&Wb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yyr=Wb&&Wb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xyr=Wb&&Wb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kyr(e,t,r);return Yyr(e,t),e};Object.defineProperty(Wb,"__esModule",{value:!0});Wb.AssistantMessage=void 0;var AF=Xyr($()),Zyr=dX(),Qyr=G_e(),ebr=R4();Wb.AssistantMessage=AF.serialization.object({toolCalls:AF.serialization.property("tool_calls",AF.serialization.list(Zyr.ToolCall2).optional()),toolPlan:AF.serialization.property("tool_plan",AF.serialization.string().optional()),content:Qyr.AssistantMessageContent.optional(),citations:AF.serialization.list(ebr.Citation).optional()})});var Y_e=b(Jb=>{"use strict";var tbr=Jb&&Jb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rbr=Jb&&Jb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nbr=Jb&&Jb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tbr(e,t,r);return rbr(e,t),e};Object.defineProperty(Jb,"__esModule",{value:!0});Jb.SystemMessageContentItem=void 0;var obr=nbr($()),ibr=TF();Jb.SystemMessageContentItem=obr.serialization.union("type",{text:ibr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var Z_e=b(Gb=>{"use strict";var abr=Gb&&Gb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sbr=Gb&&Gb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ubr=Gb&&Gb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&abr(e,t,r);return sbr(e,t),e};Object.defineProperty(Gb,"__esModule",{value:!0});Gb.SystemMessageContent=void 0;var X_e=ubr($()),lbr=Y_e();Gb.SystemMessageContent=X_e.serialization.undiscriminatedUnion([X_e.serialization.string(),X_e.serialization.list(lbr.SystemMessageContentItem)])});var Q_e=b(Kb=>{"use strict";var cbr=Kb&&Kb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dbr=Kb&&Kb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fbr=Kb&&Kb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cbr(e,t,r);return dbr(e,t),e};Object.defineProperty(Kb,"__esModule",{value:!0});Kb.SystemMessage=void 0;var pbr=fbr($()),hbr=Z_e();Kb.SystemMessage=pbr.serialization.object({content:hbr.SystemMessageContent})});var eve=b(Yb=>{"use strict";var mbr=Yb&&Yb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gbr=Yb&&Yb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ybr=Yb&&Yb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mbr(e,t,r);return gbr(e,t),e};Object.defineProperty(Yb,"__esModule",{value:!0});Yb.ToolContent=void 0;var fX=ybr($());Yb.ToolContent=fX.serialization.object({output:fX.serialization.record(fX.serialization.string(),fX.serialization.unknown())})});var tve=b(Xb=>{"use strict";var bbr=Xb&&Xb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_br=Xb&&Xb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vbr=Xb&&Xb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bbr(e,t,r);return _br(e,t),e};Object.defineProperty(Xb,"__esModule",{value:!0});Xb.ToolMessage2ToolContentItem=void 0;var wbr=vbr($()),Sbr=eve();Xb.ToolMessage2ToolContentItem=wbr.serialization.union("type",{tool_result_object:Sbr.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var rve=b(Zb=>{"use strict";var xbr=Zb&&Zb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cbr=Zb&&Zb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Obr=Zb&&Zb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xbr(e,t,r);return Cbr(e,t),e};Object.defineProperty(Zb,"__esModule",{value:!0});Zb.ToolMessage2=void 0;var I4=Obr($()),Ebr=tve();Zb.ToolMessage2=I4.serialization.object({toolCallId:I4.serialization.property("tool_call_id",I4.serialization.string()),toolContent:I4.serialization.property("tool_content",I4.serialization.list(Ebr.ToolMessage2ToolContentItem))})});var nve=b(Qb=>{"use strict";var Pbr=Qb&&Qb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tbr=Qb&&Qb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mbr=Qb&&Qb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pbr(e,t,r);return Tbr(e,t),e};Object.defineProperty(Qb,"__esModule",{value:!0});Qb.ChatMessage2=void 0;var Abr=Mbr($()),Rbr=B_e(),Ibr=K_e(),Dbr=Q_e(),jbr=rve();Qb.ChatMessage2=Abr.serialization.union("role",{user:Rbr.UserMessage,assistant:Ibr.AssistantMessage,system:Dbr.SystemMessage,tool:jbr.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var pX=b(e_=>{"use strict";var Nbr=e_&&e_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lbr=e_&&e_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fbr=e_&&e_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nbr(e,t,r);return Lbr(e,t),e};Object.defineProperty(e_,"__esModule",{value:!0});e_.ChatMessages=void 0;var kbr=Fbr($()),Bbr=nve();e_.ChatMessages=kbr.serialization.list(Bbr.ChatMessage2)});var ove=b(t_=>{"use strict";var $br=t_&&t_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qbr=t_&&t_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ubr=t_&&t_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$br(e,t,r);return qbr(e,t),e};Object.defineProperty(t_,"__esModule",{value:!0});t_.Tool2Function=void 0;var RF=Ubr($());t_.Tool2Function=RF.serialization.object({name:RF.serialization.string().optional(),description:RF.serialization.string().optional(),parameters:RF.serialization.record(RF.serialization.string(),RF.serialization.unknown()).optional()})});var hX=b(r_=>{"use strict";var zbr=r_&&r_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hbr=r_&&r_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vbr=r_&&r_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zbr(e,t,r);return Hbr(e,t),e};Object.defineProperty(r_,"__esModule",{value:!0});r_.Tool2=void 0;var bpt=Vbr($()),Wbr=ove();r_.Tool2=bpt.serialization.object({type:bpt.serialization.stringLiteral("function").optional(),function:Wbr.Tool2Function.optional()})});var mX=b(n_=>{"use strict";var Jbr=n_&&n_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gbr=n_&&n_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kbr=n_&&n_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jbr(e,t,r);return Gbr(e,t),e};Object.defineProperty(n_,"__esModule",{value:!0});n_.ChatFinishReason=void 0;var Ybr=Kbr($());n_.ChatFinishReason=Ybr.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var ive=b(o_=>{"use strict";var Xbr=o_&&o_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zbr=o_&&o_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qbr=o_&&o_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xbr(e,t,r);return Zbr(e,t),e};Object.defineProperty(o_,"__esModule",{value:!0});o_.AssistantMessageResponseContentItem=void 0;var e_r=Qbr($()),t_r=TF();o_.AssistantMessageResponseContentItem=e_r.serialization.union("type",{text:t_r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var ave=b(i_=>{"use strict";var r_r=i_&&i_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n_r=i_&&i_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o_r=i_&&i_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r_r(e,t,r);return n_r(e,t),e};Object.defineProperty(i_,"__esModule",{value:!0});i_.AssistantMessageResponse=void 0;var FP=o_r($()),i_r=dX(),a_r=ive(),s_r=R4();i_.AssistantMessageResponse=FP.serialization.object({role:FP.serialization.stringLiteral("assistant"),toolCalls:FP.serialization.property("tool_calls",FP.serialization.list(i_r.ToolCall2).optional()),toolPlan:FP.serialization.property("tool_plan",FP.serialization.string().optional()),content:FP.serialization.list(a_r.AssistantMessageResponseContentItem).optional(),citations:FP.serialization.list(s_r.Citation).optional()})});var sve=b(a_=>{"use strict";var u_r=a_&&a_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l_r=a_&&a_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c_r=a_&&a_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u_r(e,t,r);return l_r(e,t),e};Object.defineProperty(a_,"__esModule",{value:!0});a_.UsageBilledUnits=void 0;var kP=c_r($());a_.UsageBilledUnits=kP.serialization.object({inputTokens:kP.serialization.property("input_tokens",kP.serialization.number().optional()),outputTokens:kP.serialization.property("output_tokens",kP.serialization.number().optional()),searchUnits:kP.serialization.property("search_units",kP.serialization.number().optional()),classifications:kP.serialization.number().optional()})});var uve=b(s_=>{"use strict";var d_r=s_&&s_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f_r=s_&&s_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p_r=s_&&s_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d_r(e,t,r);return f_r(e,t),e};Object.defineProperty(s_,"__esModule",{value:!0});s_.UsageTokens=void 0;var D4=p_r($());s_.UsageTokens=D4.serialization.object({inputTokens:D4.serialization.property("input_tokens",D4.serialization.number().optional()),outputTokens:D4.serialization.property("output_tokens",D4.serialization.number().optional())})});var gX=b(u_=>{"use strict";var h_r=u_&&u_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m_r=u_&&u_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g_r=u_&&u_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h_r(e,t,r);return m_r(e,t),e};Object.defineProperty(u_,"__esModule",{value:!0});u_.Usage=void 0;var _pt=g_r($()),y_r=sve(),b_r=uve();u_.Usage=_pt.serialization.object({billedUnits:_pt.serialization.property("billed_units",y_r.UsageBilledUnits.optional()),tokens:b_r.UsageTokens.optional()})});var vpt=b(l_=>{"use strict";var __r=l_&&l_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v_r=l_&&l_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w_r=l_&&l_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&__r(e,t,r);return v_r(e,t),e};Object.defineProperty(l_,"__esModule",{value:!0});l_.NonStreamedChatResponse2=void 0;var yX=w_r($()),S_r=mX(),x_r=ave(),C_r=gX();l_.NonStreamedChatResponse2=yX.serialization.object({id:yX.serialization.string(),finishReason:yX.serialization.property("finish_reason",S_r.ChatFinishReason),prompt:yX.serialization.string().optional(),message:x_r.AssistantMessageResponse.optional(),usage:C_r.Usage.optional()})});var Cp=b(c_=>{"use strict";var O_r=c_&&c_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E_r=c_&&c_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P_r=c_&&c_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&O_r(e,t,r);return E_r(e,t),e};Object.defineProperty(c_,"__esModule",{value:!0});c_.ChatStreamEventType=void 0;var T_r=P_r($());c_.ChatStreamEventType=T_r.serialization.object({})});var lve=b(d_=>{"use strict";var M_r=d_&&d_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A_r=d_&&d_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R_r=d_&&d_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M_r(e,t,r);return A_r(e,t),e};Object.defineProperty(d_,"__esModule",{value:!0});d_.ChatMessageStartEventDeltaMessage=void 0;var wpt=R_r($());d_.ChatMessageStartEventDeltaMessage=wpt.serialization.object({role:wpt.serialization.stringLiteral("assistant").optional()})});var cve=b(f_=>{"use strict";var I_r=f_&&f_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D_r=f_&&f_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j_r=f_&&f_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I_r(e,t,r);return D_r(e,t),e};Object.defineProperty(f_,"__esModule",{value:!0});f_.ChatMessageStartEventDelta=void 0;var N_r=j_r($()),L_r=lve();f_.ChatMessageStartEventDelta=N_r.serialization.object({message:L_r.ChatMessageStartEventDeltaMessage.optional()})});var dve=b(p_=>{"use strict";var F_r=p_&&p_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k_r=p_&&p_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B_r=p_&&p_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F_r(e,t,r);return k_r(e,t),e};Object.defineProperty(p_,"__esModule",{value:!0});p_.ChatMessageStartEvent=void 0;var Spt=B_r($()),$_r=cve(),q_r=Cp();p_.ChatMessageStartEvent=Spt.serialization.object({id:Spt.serialization.string().optional(),delta:$_r.ChatMessageStartEventDelta.optional()}).extend(q_r.ChatStreamEventType)});var pve=b(h_=>{"use strict";var U_r=h_&&h_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z_r=h_&&h_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H_r=h_&&h_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U_r(e,t,r);return z_r(e,t),e};Object.defineProperty(h_,"__esModule",{value:!0});h_.ChatContentStartEventDeltaMessageContent=void 0;var fve=H_r($());h_.ChatContentStartEventDeltaMessageContent=fve.serialization.object({text:fve.serialization.string().optional(),type:fve.serialization.stringLiteral("text").optional()})});var hve=b(m_=>{"use strict";var V_r=m_&&m_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W_r=m_&&m_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J_r=m_&&m_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V_r(e,t,r);return W_r(e,t),e};Object.defineProperty(m_,"__esModule",{value:!0});m_.ChatContentStartEventDeltaMessage=void 0;var G_r=J_r($()),K_r=pve();m_.ChatContentStartEventDeltaMessage=G_r.serialization.object({content:K_r.ChatContentStartEventDeltaMessageContent.optional()})});var mve=b(g_=>{"use strict";var Y_r=g_&&g_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X_r=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z_r=g_&&g_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y_r(e,t,r);return X_r(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.ChatContentStartEventDelta=void 0;var Q_r=Z_r($()),evr=hve();g_.ChatContentStartEventDelta=Q_r.serialization.object({message:evr.ChatContentStartEventDeltaMessage.optional()})});var gve=b(y_=>{"use strict";var tvr=y_&&y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rvr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nvr=y_&&y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tvr(e,t,r);return rvr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.ChatContentStartEvent=void 0;var xpt=nvr($()),ovr=mve(),ivr=Cp();y_.ChatContentStartEvent=xpt.serialization.object({index:xpt.serialization.number().optional(),delta:ovr.ChatContentStartEventDelta.optional()}).extend(ivr.ChatStreamEventType)});var yve=b(b_=>{"use strict";var avr=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),svr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uvr=b_&&b_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&avr(e,t,r);return svr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.ChatContentDeltaEventDeltaMessageContent=void 0;var Cpt=uvr($());b_.ChatContentDeltaEventDeltaMessageContent=Cpt.serialization.object({text:Cpt.serialization.string().optional()})});var bve=b(__=>{"use strict";var lvr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cvr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dvr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lvr(e,t,r);return cvr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.ChatContentDeltaEventDeltaMessage=void 0;var fvr=dvr($()),pvr=yve();__.ChatContentDeltaEventDeltaMessage=fvr.serialization.object({content:pvr.ChatContentDeltaEventDeltaMessageContent.optional()})});var _ve=b(v_=>{"use strict";var hvr=v_&&v_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mvr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gvr=v_&&v_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hvr(e,t,r);return mvr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.ChatContentDeltaEventDelta=void 0;var yvr=gvr($()),bvr=bve();v_.ChatContentDeltaEventDelta=yvr.serialization.object({message:bvr.ChatContentDeltaEventDeltaMessage.optional()})});var vve=b(w_=>{"use strict";var _vr=w_&&w_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vvr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wvr=w_&&w_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_vr(e,t,r);return vvr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.ChatContentDeltaEvent=void 0;var Opt=wvr($()),Svr=_ve(),xvr=Cp();w_.ChatContentDeltaEvent=Opt.serialization.object({index:Opt.serialization.number().optional(),delta:Svr.ChatContentDeltaEventDelta.optional()}).extend(xvr.ChatStreamEventType)});var wve=b(S_=>{"use strict";var Cvr=S_&&S_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ovr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Evr=S_&&S_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cvr(e,t,r);return Ovr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.ChatContentEndEvent=void 0;var Ept=Evr($()),Pvr=Cp();S_.ChatContentEndEvent=Ept.serialization.object({index:Ept.serialization.number().optional()}).extend(Pvr.ChatStreamEventType)});var xve=b(x_=>{"use strict";var Tvr=x_&&x_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mvr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Avr=x_&&x_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tvr(e,t,r);return Mvr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.ChatToolPlanDeltaEventDelta=void 0;var Sve=Avr($());x_.ChatToolPlanDeltaEventDelta=Sve.serialization.object({toolPlan:Sve.serialization.property("tool_plan",Sve.serialization.string().optional())})});var Cve=b(C_=>{"use strict";var Rvr=C_&&C_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ivr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dvr=C_&&C_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rvr(e,t,r);return Ivr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.ChatToolPlanDeltaEvent=void 0;var jvr=Dvr($()),Nvr=xve(),Lvr=Cp();C_.ChatToolPlanDeltaEvent=jvr.serialization.object({delta:Nvr.ChatToolPlanDeltaEventDelta.optional()}).extend(Lvr.ChatStreamEventType)});var Eve=b(O_=>{"use strict";var Fvr=O_&&O_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kvr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bvr=O_&&O_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fvr(e,t,r);return kvr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.ChatToolCallStartEventDeltaToolCallFunction=void 0;var Ove=Bvr($());O_.ChatToolCallStartEventDeltaToolCallFunction=Ove.serialization.object({name:Ove.serialization.string().optional(),arguments:Ove.serialization.string().optional()})});var Tve=b(E_=>{"use strict";var $vr=E_&&E_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qvr=E_&&E_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uvr=E_&&E_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$vr(e,t,r);return qvr(e,t),e};Object.defineProperty(E_,"__esModule",{value:!0});E_.ChatToolCallStartEventDeltaToolCall=void 0;var Pve=Uvr($()),zvr=Eve();E_.ChatToolCallStartEventDeltaToolCall=Pve.serialization.object({id:Pve.serialization.string().optional(),type:Pve.serialization.stringLiteral("function").optional(),function:zvr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var Mve=b(P_=>{"use strict";var Hvr=P_&&P_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vvr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wvr=P_&&P_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hvr(e,t,r);return Vvr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.ChatToolCallStartEventDelta=void 0;var Ppt=Wvr($()),Jvr=Tve();P_.ChatToolCallStartEventDelta=Ppt.serialization.object({toolCall:Ppt.serialization.property("tool_call",Jvr.ChatToolCallStartEventDeltaToolCall.optional())})});var Ave=b(T_=>{"use strict";var Gvr=T_&&T_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kvr=T_&&T_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yvr=T_&&T_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gvr(e,t,r);return Kvr(e,t),e};Object.defineProperty(T_,"__esModule",{value:!0});T_.ChatToolCallStartEvent=void 0;var Tpt=Yvr($()),Xvr=Mve(),Zvr=Cp();T_.ChatToolCallStartEvent=Tpt.serialization.object({index:Tpt.serialization.number().optional(),delta:Xvr.ChatToolCallStartEventDelta.optional()}).extend(Zvr.ChatStreamEventType)});var Rve=b(M_=>{"use strict";var Qvr=M_&&M_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e0r=M_&&M_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t0r=M_&&M_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qvr(e,t,r);return e0r(e,t),e};Object.defineProperty(M_,"__esModule",{value:!0});M_.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var Mpt=t0r($());M_.ChatToolCallDeltaEventDeltaToolCallFunction=Mpt.serialization.object({arguments:Mpt.serialization.string().optional()})});var Ive=b(A_=>{"use strict";var r0r=A_&&A_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n0r=A_&&A_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o0r=A_&&A_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r0r(e,t,r);return n0r(e,t),e};Object.defineProperty(A_,"__esModule",{value:!0});A_.ChatToolCallDeltaEventDeltaToolCall=void 0;var i0r=o0r($()),a0r=Rve();A_.ChatToolCallDeltaEventDeltaToolCall=i0r.serialization.object({function:a0r.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var Dve=b(R_=>{"use strict";var s0r=R_&&R_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u0r=R_&&R_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l0r=R_&&R_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s0r(e,t,r);return u0r(e,t),e};Object.defineProperty(R_,"__esModule",{value:!0});R_.ChatToolCallDeltaEventDelta=void 0;var Apt=l0r($()),c0r=Ive();R_.ChatToolCallDeltaEventDelta=Apt.serialization.object({toolCall:Apt.serialization.property("tool_call",c0r.ChatToolCallDeltaEventDeltaToolCall.optional())})});var jve=b(I_=>{"use strict";var d0r=I_&&I_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f0r=I_&&I_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p0r=I_&&I_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d0r(e,t,r);return f0r(e,t),e};Object.defineProperty(I_,"__esModule",{value:!0});I_.ChatToolCallDeltaEvent=void 0;var Rpt=p0r($()),h0r=Dve(),m0r=Cp();I_.ChatToolCallDeltaEvent=Rpt.serialization.object({index:Rpt.serialization.number().optional(),delta:h0r.ChatToolCallDeltaEventDelta.optional()}).extend(m0r.ChatStreamEventType)});var Nve=b(D_=>{"use strict";var g0r=D_&&D_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y0r=D_&&D_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b0r=D_&&D_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g0r(e,t,r);return y0r(e,t),e};Object.defineProperty(D_,"__esModule",{value:!0});D_.ChatToolCallEndEvent=void 0;var Ipt=b0r($()),_0r=Cp();D_.ChatToolCallEndEvent=Ipt.serialization.object({index:Ipt.serialization.number().optional()}).extend(_0r.ChatStreamEventType)});var Lve=b(j_=>{"use strict";var v0r=j_&&j_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w0r=j_&&j_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S0r=j_&&j_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&v0r(e,t,r);return w0r(e,t),e};Object.defineProperty(j_,"__esModule",{value:!0});j_.ChatMessageEndEventDelta=void 0;var Dpt=S0r($()),x0r=mX(),C0r=gX();j_.ChatMessageEndEventDelta=Dpt.serialization.object({finishReason:Dpt.serialization.property("finish_reason",x0r.ChatFinishReason.optional()),usage:C0r.Usage.optional()})});var Fve=b(N_=>{"use strict";var O0r=N_&&N_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E0r=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P0r=N_&&N_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&O0r(e,t,r);return E0r(e,t),e};Object.defineProperty(N_,"__esModule",{value:!0});N_.ChatMessageEndEvent=void 0;var jpt=P0r($()),T0r=Lve(),M0r=Cp();N_.ChatMessageEndEvent=jpt.serialization.object({id:jpt.serialization.string().optional(),delta:T0r.ChatMessageEndEventDelta.optional()}).extend(M0r.ChatStreamEventType)});var kve=b(L_=>{"use strict";var A0r=L_&&L_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R0r=L_&&L_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I0r=L_&&L_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A0r(e,t,r);return R0r(e,t),e};Object.defineProperty(L_,"__esModule",{value:!0});L_.CitationStartEventDeltaMessage=void 0;var D0r=I0r($()),j0r=R4();L_.CitationStartEventDeltaMessage=D0r.serialization.object({citations:j0r.Citation.optional()})});var Bve=b(F_=>{"use strict";var N0r=F_&&F_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L0r=F_&&F_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F0r=F_&&F_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N0r(e,t,r);return L0r(e,t),e};Object.defineProperty(F_,"__esModule",{value:!0});F_.CitationStartEventDelta=void 0;var k0r=F0r($()),B0r=kve();F_.CitationStartEventDelta=k0r.serialization.object({message:B0r.CitationStartEventDeltaMessage.optional()})});var $ve=b(k_=>{"use strict";var $0r=k_&&k_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q0r=k_&&k_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U0r=k_&&k_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$0r(e,t,r);return q0r(e,t),e};Object.defineProperty(k_,"__esModule",{value:!0});k_.CitationStartEvent=void 0;var Npt=U0r($()),z0r=Bve(),H0r=Cp();k_.CitationStartEvent=Npt.serialization.object({index:Npt.serialization.number().optional(),delta:z0r.CitationStartEventDelta.optional()}).extend(H0r.ChatStreamEventType)});var qve=b(B_=>{"use strict";var V0r=B_&&B_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W0r=B_&&B_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J0r=B_&&B_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V0r(e,t,r);return W0r(e,t),e};Object.defineProperty(B_,"__esModule",{value:!0});B_.CitationEndEvent=void 0;var Lpt=J0r($()),G0r=Cp();B_.CitationEndEvent=Lpt.serialization.object({index:Lpt.serialization.number().optional()}).extend(G0r.ChatStreamEventType)});var Fpt=b($_=>{"use strict";var K0r=$_&&$_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y0r=$_&&$_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X0r=$_&&$_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K0r(e,t,r);return Y0r(e,t),e};Object.defineProperty($_,"__esModule",{value:!0});$_.StreamedChatResponse2=void 0;var Z0r=X0r($()),Q0r=dve(),ewr=gve(),twr=vve(),rwr=wve(),nwr=Cve(),owr=Ave(),iwr=jve(),awr=Nve(),swr=$ve(),uwr=qve(),lwr=Fve();$_.StreamedChatResponse2=Z0r.serialization.union("type",{"message-start":Q0r.ChatMessageStartEvent,"content-start":ewr.ChatContentStartEvent,"content-delta":twr.ChatContentDeltaEvent,"content-end":rwr.ChatContentEndEvent,"tool-plan-delta":nwr.ChatToolPlanDeltaEvent,"tool-call-start":owr.ChatToolCallStartEvent,"tool-call-delta":iwr.ChatToolCallDeltaEvent,"tool-call-end":awr.ChatToolCallEndEvent,"citation-start":swr.CitationStartEvent,"citation-end":uwr.CitationEndEvent,"message-end":lwr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var Uve=b(lt=>{"use strict";var cwr=lt&&lt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_t=lt&&lt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cwr(e,t,r)};Object.defineProperty(lt,"__esModule",{value:!0});_t(D_e(),lt);_t(j_e(),lt);_t(TF(),lt);_t(N_e(),lt);_t(F_e(),lt);_t(B_e(),lt);_t(q_e(),lt);_t(dX(),lt);_t(z_e(),lt);_t(H_e(),lt);_t(V_e(),lt);_t(R4(),lt);_t(W_e(),lt);_t(G_e(),lt);_t(K_e(),lt);_t(Y_e(),lt);_t(Z_e(),lt);_t(Q_e(),lt);_t(eve(),lt);_t(tve(),lt);_t(rve(),lt);_t(nve(),lt);_t(pX(),lt);_t(ove(),lt);_t(hX(),lt);_t(mX(),lt);_t(ive(),lt);_t(ave(),lt);_t(sve(),lt);_t(uve(),lt);_t(gX(),lt);_t(vpt(),lt);_t(Cp(),lt);_t(lve(),lt);_t(cve(),lt);_t(dve(),lt);_t(pve(),lt);_t(hve(),lt);_t(mve(),lt);_t(gve(),lt);_t(yve(),lt);_t(bve(),lt);_t(_ve(),lt);_t(vve(),lt);_t(wve(),lt);_t(xve(),lt);_t(Cve(),lt);_t(Eve(),lt);_t(Tve(),lt);_t(Mve(),lt);_t(Ave(),lt);_t(Rve(),lt);_t(Ive(),lt);_t(Dve(),lt);_t(jve(),lt);_t(Nve(),lt);_t(Lve(),lt);_t(Fve(),lt);_t(Fpt(),lt)});var bX=b(q_=>{"use strict";var dwr=q_&&q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fwr=q_&&q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pwr=q_&&q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dwr(e,t,r);return fwr(e,t),e};Object.defineProperty(q_,"__esModule",{value:!0});q_.TextResponseFormat=void 0;var hwr=pwr($());q_.TextResponseFormat=hwr.serialization.object({})});var zve=b(U_=>{"use strict";var mwr=U_&&U_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gwr=U_&&U_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ywr=U_&&U_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mwr(e,t,r);return gwr(e,t),e};Object.defineProperty(U_,"__esModule",{value:!0});U_.JsonResponseFormat2=void 0;var j4=ywr($());U_.JsonResponseFormat2=j4.serialization.object({jsonSchema:j4.serialization.property("json_schema",j4.serialization.record(j4.serialization.string(),j4.serialization.unknown()).optional())})});var _X=b(z_=>{"use strict";var bwr=z_&&z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_wr=z_&&z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vwr=z_&&z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bwr(e,t,r);return _wr(e,t),e};Object.defineProperty(z_,"__esModule",{value:!0});z_.ResponseFormat2=void 0;var wwr=vwr($()),Swr=bX(),xwr=zve();z_.ResponseFormat2=wwr.serialization.union("type",{text:Swr.TextResponseFormat,json_object:xwr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var kpt=b(H_=>{"use strict";var Cwr=H_&&H_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Owr=H_&&H_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ewr=H_&&H_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cwr(e,t,r);return Owr(e,t),e};Object.defineProperty(H_,"__esModule",{value:!0});H_.V2ChatStreamRequest=void 0;var Ss=Ewr($()),Pwr=pX(),Twr=hX(),Mwr=D_e(),Awr=_X();H_.V2ChatStreamRequest=Ss.serialization.object({model:Ss.serialization.string(),messages:Pwr.ChatMessages,tools:Ss.serialization.list(Twr.Tool2).optional(),citationMode:Ss.serialization.property("citation_mode",Mwr.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ss.serialization.property("response_format",Awr.ResponseFormat2.optional()),maxTokens:Ss.serialization.property("max_tokens",Ss.serialization.number().optional()),stopSequences:Ss.serialization.property("stop_sequences",Ss.serialization.list(Ss.serialization.string()).optional()),temperature:Ss.serialization.number().optional(),seed:Ss.serialization.number().optional(),frequencyPenalty:Ss.serialization.property("frequency_penalty",Ss.serialization.number().optional()),presencePenalty:Ss.serialization.property("presence_penalty",Ss.serialization.number().optional()),k:Ss.serialization.number().optional(),p:Ss.serialization.number().optional(),returnPrompt:Ss.serialization.property("return_prompt",Ss.serialization.boolean().optional())})});var Bpt=b(V_=>{"use strict";var Rwr=V_&&V_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iwr=V_&&V_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dwr=V_&&V_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rwr(e,t,r);return Iwr(e,t),e};Object.defineProperty(V_,"__esModule",{value:!0});V_.V2ChatRequest=void 0;var xs=Dwr($()),jwr=pX(),Nwr=hX(),Lwr=j_e(),Fwr=_X();V_.V2ChatRequest=xs.serialization.object({model:xs.serialization.string(),messages:jwr.ChatMessages,tools:xs.serialization.list(Nwr.Tool2).optional(),citationMode:xs.serialization.property("citation_mode",Lwr.V2ChatRequestCitationMode.optional()),responseFormat:xs.serialization.property("response_format",Fwr.ResponseFormat2.optional()),maxTokens:xs.serialization.property("max_tokens",xs.serialization.number().optional()),stopSequences:xs.serialization.property("stop_sequences",xs.serialization.list(xs.serialization.string()).optional()),temperature:xs.serialization.number().optional(),seed:xs.serialization.number().optional(),frequencyPenalty:xs.serialization.property("frequency_penalty",xs.serialization.number().optional()),presencePenalty:xs.serialization.property("presence_penalty",xs.serialization.number().optional()),k:xs.serialization.number().optional(),p:xs.serialization.number().optional(),returnPrompt:xs.serialization.property("return_prompt",xs.serialization.boolean().optional())})});var Hve=b(IF=>{"use strict";Object.defineProperty(IF,"__esModule",{value:!0});IF.V2ChatRequest=IF.V2ChatStreamRequest=void 0;var kwr=kpt();Object.defineProperty(IF,"V2ChatStreamRequest",{enumerable:!0,get:function(){return kwr.V2ChatStreamRequest}});var Bwr=Bpt();Object.defineProperty(IF,"V2ChatRequest",{enumerable:!0,get:function(){return Bwr.V2ChatRequest}})});var $pt=b(OI=>{"use strict";var $wr=OI&&OI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qwr=OI&&OI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$wr(e,t,r)};Object.defineProperty(OI,"__esModule",{value:!0});qwr(Hve(),OI)});var Upt=b(BP=>{"use strict";var Uwr=BP&&BP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qpt=BP&&BP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Uwr(e,t,r)};Object.defineProperty(BP,"__esModule",{value:!0});qpt(Uve(),BP);qpt($pt(),BP)});var Vve=b(W_=>{"use strict";var zwr=W_&&W_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hwr=W_&&W_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vwr=W_&&W_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zwr(e,t,r);return Hwr(e,t),e};Object.defineProperty(W_,"__esModule",{value:!0});W_.CreateEmbedJobRequestTruncate=void 0;var Wwr=Vwr($());W_.CreateEmbedJobRequestTruncate=Wwr.serialization.enum_(["START","END"])});var Wve=b(EI=>{"use strict";var Jwr=EI&&EI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gwr=EI&&EI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jwr(e,t,r)};Object.defineProperty(EI,"__esModule",{value:!0});Gwr(Vve(),EI)});var vX=b(J_=>{"use strict";var Kwr=J_&&J_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ywr=J_&&J_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xwr=J_&&J_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kwr(e,t,r);return Ywr(e,t),e};Object.defineProperty(J_,"__esModule",{value:!0});J_.EmbedInputType=void 0;var Zwr=Xwr($());J_.EmbedInputType=Zwr.serialization.enum_(["search_document","search_query","classification","clustering"])});var wX=b(G_=>{"use strict";var Qwr=G_&&G_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eSr=G_&&G_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tSr=G_&&G_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qwr(e,t,r);return eSr(e,t),e};Object.defineProperty(G_,"__esModule",{value:!0});G_.EmbeddingType=void 0;var rSr=tSr($());G_.EmbeddingType=rSr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var zpt=b(K_=>{"use strict";var nSr=K_&&K_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oSr=K_&&K_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iSr=K_&&K_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nSr(e,t,r);return oSr(e,t),e};Object.defineProperty(K_,"__esModule",{value:!0});K_.CreateEmbedJobRequest=void 0;var $P=iSr($()),aSr=vX(),sSr=wX(),uSr=Vve();K_.CreateEmbedJobRequest=$P.serialization.object({model:$P.serialization.string(),datasetId:$P.serialization.property("dataset_id",$P.serialization.string()),inputType:$P.serialization.property("input_type",aSr.EmbedInputType),name:$P.serialization.string().optional(),embeddingTypes:$P.serialization.property("embedding_types",$P.serialization.list(sSr.EmbeddingType).optional()),truncate:uSr.CreateEmbedJobRequestTruncate.optional()})});var Jve=b(SX=>{"use strict";Object.defineProperty(SX,"__esModule",{value:!0});SX.CreateEmbedJobRequest=void 0;var lSr=zpt();Object.defineProperty(SX,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return lSr.CreateEmbedJobRequest}})});var Hpt=b(PI=>{"use strict";var cSr=PI&&PI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dSr=PI&&PI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cSr(e,t,r)};Object.defineProperty(PI,"__esModule",{value:!0});dSr(Jve(),PI)});var Wpt=b(qP=>{"use strict";var fSr=qP&&qP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vpt=qP&&qP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fSr(e,t,r)};Object.defineProperty(qP,"__esModule",{value:!0});Vpt(Wve(),qP);Vpt(Hpt(),qP)});var Gve=b(Y_=>{"use strict";var pSr=Y_&&Y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hSr=Y_&&Y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mSr=Y_&&Y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pSr(e,t,r);return hSr(e,t),e};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.DatasetType=void 0;var gSr=mSr($());Y_.DatasetType=gSr.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 Kve=b(X_=>{"use strict";var ySr=X_&&X_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bSr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Sr=X_&&X_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ySr(e,t,r);return bSr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.DatasetValidationStatus=void 0;var vSr=_Sr($());X_.DatasetValidationStatus=vSr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var Yve=b(Z_=>{"use strict";var wSr=Z_&&Z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SSr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xSr=Z_&&Z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wSr(e,t,r);return SSr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.DatasetPart=void 0;var Op=xSr($());Z_.DatasetPart=Op.serialization.object({id:Op.serialization.string(),name:Op.serialization.string(),url:Op.serialization.string().optional(),index:Op.serialization.number().optional(),sizeBytes:Op.serialization.property("size_bytes",Op.serialization.number().optional()),numRows:Op.serialization.property("num_rows",Op.serialization.number().optional()),originalUrl:Op.serialization.property("original_url",Op.serialization.string().optional()),samples:Op.serialization.list(Op.serialization.string()).optional()})});var xX=b(Q_=>{"use strict";var CSr=Q_&&Q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OSr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESr=Q_&&Q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CSr(e,t,r);return OSr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.Dataset=void 0;var ga=ESr($()),PSr=Gve(),TSr=Kve(),MSr=Yve();Q_.Dataset=ga.serialization.object({id:ga.serialization.string(),name:ga.serialization.string(),createdAt:ga.serialization.property("created_at",ga.serialization.date()),updatedAt:ga.serialization.property("updated_at",ga.serialization.date()),datasetType:ga.serialization.property("dataset_type",PSr.DatasetType),validationStatus:ga.serialization.property("validation_status",TSr.DatasetValidationStatus),validationError:ga.serialization.property("validation_error",ga.serialization.string().optional()),schema:ga.serialization.string().optional(),requiredFields:ga.serialization.property("required_fields",ga.serialization.list(ga.serialization.string()).optional()),preserveFields:ga.serialization.property("preserve_fields",ga.serialization.list(ga.serialization.string()).optional()),datasetParts:ga.serialization.property("dataset_parts",ga.serialization.list(MSr.DatasetPart).optional()),validationWarnings:ga.serialization.property("validation_warnings",ga.serialization.list(ga.serialization.string()).optional())})});var Gpt=b(ev=>{"use strict";var ASr=ev&&ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RSr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ISr=ev&&ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ASr(e,t,r);return RSr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.DatasetsListResponse=void 0;var Jpt=ISr($()),DSr=xX();ev.DatasetsListResponse=Jpt.serialization.object({datasets:Jpt.serialization.list(DSr.Dataset).optional()})});var Kpt=b(tv=>{"use strict";var jSr=tv&&tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NSr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LSr=tv&&tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jSr(e,t,r);return NSr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.DatasetsCreateResponseDatasetPartsItem=void 0;var UP=LSr($());tv.DatasetsCreateResponseDatasetPartsItem=UP.serialization.object({name:UP.serialization.string().optional(),numRows:UP.serialization.property("num_rows",UP.serialization.number().optional()),samples:UP.serialization.list(UP.serialization.string()).optional(),partKind:UP.serialization.property("part_kind",UP.serialization.string().optional())})});var Xpt=b(rv=>{"use strict";var FSr=rv&&rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kSr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BSr=rv&&rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FSr(e,t,r);return kSr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.DatasetsCreateResponse=void 0;var Ypt=BSr($());rv.DatasetsCreateResponse=Ypt.serialization.object({id:Ypt.serialization.string().optional()})});var Zpt=b(nv=>{"use strict";var $Sr=nv&&nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qSr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),USr=nv&&nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Sr(e,t,r);return qSr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.DatasetsGetUsageResponse=void 0;var Xve=USr($());nv.DatasetsGetUsageResponse=Xve.serialization.object({organizationUsage:Xve.serialization.property("organization_usage",Xve.serialization.number().optional())})});var Qpt=b(ov=>{"use strict";var zSr=ov&&ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HSr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VSr=ov&&ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zSr(e,t,r);return HSr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.DatasetsGetResponse=void 0;var WSr=VSr($()),JSr=xX();ov.DatasetsGetResponse=WSr.serialization.object({dataset:JSr.Dataset})});var Zve=b(Og=>{"use strict";var GSr=Og&&Og.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N4=Og&&Og.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GSr(e,t,r)};Object.defineProperty(Og,"__esModule",{value:!0});N4(Gpt(),Og);N4(Kpt(),Og);N4(Xpt(),Og);N4(Zpt(),Og);N4(Qpt(),Og)});var eht=b(iv=>{"use strict";var KSr=iv&&iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YSr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XSr=iv&&iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KSr(e,t,r);return YSr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.Response=void 0;var Qve=XSr($());iv.Response=Qve.serialization.record(Qve.serialization.string(),Qve.serialization.unknown())});var tht=b(av=>{"use strict";var ZSr=av&&av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QSr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),exr=av&&av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZSr(e,t,r);return QSr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.delete=void 0;av.delete=exr(eht())});var nht=b(zP=>{"use strict";var txr=zP&&zP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rht=zP&&zP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&txr(e,t,r)};Object.defineProperty(zP,"__esModule",{value:!0});rht(Zve(),zP);rht(tht(),zP)});var e0e=b(sv=>{"use strict";var rxr=sv&&sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nxr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oxr=sv&&sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rxr(e,t,r);return nxr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.BaseType=void 0;var ixr=oxr($());sv.BaseType=ixr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var t0e=b(uv=>{"use strict";var axr=uv&&uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sxr=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uxr=uv&&uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&axr(e,t,r);return sxr(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.Strategy=void 0;var lxr=uxr($());uv.Strategy=lxr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var r0e=b(lv=>{"use strict";var cxr=lv&&lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dxr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fxr=lv&&lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cxr(e,t,r);return dxr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.BaseModel=void 0;var CX=fxr($()),pxr=e0e(),hxr=t0e();lv.BaseModel=CX.serialization.object({name:CX.serialization.string().optional(),version:CX.serialization.string().optional(),baseType:CX.serialization.property("base_type",pxr.BaseType),strategy:hxr.Strategy.optional()})});var n0e=b(cv=>{"use strict";var mxr=cv&&cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gxr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yxr=cv&&cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mxr(e,t,r);return gxr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.Hyperparameters=void 0;var Eg=yxr($());cv.Hyperparameters=Eg.serialization.object({earlyStoppingPatience:Eg.serialization.property("early_stopping_patience",Eg.serialization.number().optional()),earlyStoppingThreshold:Eg.serialization.property("early_stopping_threshold",Eg.serialization.number().optional()),trainBatchSize:Eg.serialization.property("train_batch_size",Eg.serialization.number().optional()),trainEpochs:Eg.serialization.property("train_epochs",Eg.serialization.number().optional()),learningRate:Eg.serialization.property("learning_rate",Eg.serialization.number().optional())})});var o0e=b(dv=>{"use strict";var bxr=dv&&dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_xr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vxr=dv&&dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bxr(e,t,r);return _xr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.WandbConfig=void 0;var L4=vxr($());dv.WandbConfig=L4.serialization.object({project:L4.serialization.string(),apiKey:L4.serialization.property("api_key",L4.serialization.string()),entity:L4.serialization.string().optional()})});var OX=b(fv=>{"use strict";var wxr=fv&&fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sxr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xxr=fv&&fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wxr(e,t,r);return Sxr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.Settings=void 0;var DF=xxr($()),Cxr=r0e(),Oxr=n0e(),Exr=o0e();fv.Settings=DF.serialization.object({baseModel:DF.serialization.property("base_model",Cxr.BaseModel),datasetId:DF.serialization.property("dataset_id",DF.serialization.string()),hyperparameters:Oxr.Hyperparameters.optional(),multiLabel:DF.serialization.property("multi_label",DF.serialization.boolean().optional()),wandb:Exr.WandbConfig.optional()})});var F4=b(pv=>{"use strict";var Pxr=pv&&pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Txr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mxr=pv&&pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pxr(e,t,r);return Txr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.Status=void 0;var Axr=Mxr($());pv.Status=Axr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var jF=b(hv=>{"use strict";var Rxr=hv&&hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ixr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dxr=hv&&hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rxr(e,t,r);return Ixr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.FinetunedModel=void 0;var Ud=Dxr($()),jxr=OX(),Nxr=F4();hv.FinetunedModel=Ud.serialization.object({id:Ud.serialization.string().optional(),name:Ud.serialization.string(),creatorId:Ud.serialization.property("creator_id",Ud.serialization.string().optional()),organizationId:Ud.serialization.property("organization_id",Ud.serialization.string().optional()),settings:jxr.Settings,status:Nxr.Status.optional(),createdAt:Ud.serialization.property("created_at",Ud.serialization.date().optional()),updatedAt:Ud.serialization.property("updated_at",Ud.serialization.date().optional()),completedAt:Ud.serialization.property("completed_at",Ud.serialization.date().optional()),lastUsed:Ud.serialization.property("last_used",Ud.serialization.date().optional())})});var oht=b(mv=>{"use strict";var Lxr=mv&&mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fxr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kxr=mv&&mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lxr(e,t,r);return Fxr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.ListFinetunedModelsResponse=void 0;var TI=kxr($()),Bxr=jF();mv.ListFinetunedModelsResponse=TI.serialization.object({finetunedModels:TI.serialization.property("finetuned_models",TI.serialization.list(Bxr.FinetunedModel).optional()),nextPageToken:TI.serialization.property("next_page_token",TI.serialization.string().optional()),totalSize:TI.serialization.property("total_size",TI.serialization.number().optional())})});var aht=b(gv=>{"use strict";var $xr=gv&&gv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qxr=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uxr=gv&&gv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$xr(e,t,r);return qxr(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.CreateFinetunedModelResponse=void 0;var iht=Uxr($()),zxr=jF();gv.CreateFinetunedModelResponse=iht.serialization.object({finetunedModel:iht.serialization.property("finetuned_model",zxr.FinetunedModel.optional())})});var uht=b(yv=>{"use strict";var Hxr=yv&&yv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vxr=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wxr=yv&&yv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hxr(e,t,r);return Vxr(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.GetFinetunedModelResponse=void 0;var sht=Wxr($()),Jxr=jF();yv.GetFinetunedModelResponse=sht.serialization.object({finetunedModel:sht.serialization.property("finetuned_model",Jxr.FinetunedModel.optional())})});var lht=b(bv=>{"use strict";var Gxr=bv&&bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kxr=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yxr=bv&&bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gxr(e,t,r);return Kxr(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.DeleteFinetunedModelResponse=void 0;var i0e=Yxr($());bv.DeleteFinetunedModelResponse=i0e.serialization.record(i0e.serialization.string(),i0e.serialization.unknown())});var dht=b(_v=>{"use strict";var Xxr=_v&&_v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zxr=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qxr=_v&&_v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xxr(e,t,r);return Zxr(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.UpdateFinetunedModelResponse=void 0;var cht=Qxr($()),eCr=jF();_v.UpdateFinetunedModelResponse=cht.serialization.object({finetunedModel:cht.serialization.property("finetuned_model",eCr.FinetunedModel.optional())})});var a0e=b(vv=>{"use strict";var tCr=vv&&vv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rCr=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nCr=vv&&vv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tCr(e,t,r);return rCr(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.Event=void 0;var k4=nCr($()),oCr=F4();vv.Event=k4.serialization.object({userId:k4.serialization.property("user_id",k4.serialization.string().optional()),status:oCr.Status.optional(),createdAt:k4.serialization.property("created_at",k4.serialization.date().optional())})});var fht=b(wv=>{"use strict";var iCr=wv&&wv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aCr=wv&&wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sCr=wv&&wv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iCr(e,t,r);return aCr(e,t),e};Object.defineProperty(wv,"__esModule",{value:!0});wv.ListEventsResponse=void 0;var NF=sCr($()),uCr=a0e();wv.ListEventsResponse=NF.serialization.object({events:NF.serialization.list(uCr.Event).optional(),nextPageToken:NF.serialization.property("next_page_token",NF.serialization.string().optional()),totalSize:NF.serialization.property("total_size",NF.serialization.number().optional())})});var s0e=b(Sv=>{"use strict";var lCr=Sv&&Sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cCr=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dCr=Sv&&Sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lCr(e,t,r);return cCr(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.TrainingStepMetrics=void 0;var HP=dCr($());Sv.TrainingStepMetrics=HP.serialization.object({createdAt:HP.serialization.property("created_at",HP.serialization.date().optional()),stepNumber:HP.serialization.property("step_number",HP.serialization.number().optional()),metrics:HP.serialization.record(HP.serialization.string(),HP.serialization.number()).optional()})});var pht=b(xv=>{"use strict";var fCr=xv&&xv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pCr=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hCr=xv&&xv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fCr(e,t,r);return pCr(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.ListTrainingStepMetricsResponse=void 0;var B4=hCr($()),mCr=s0e();xv.ListTrainingStepMetricsResponse=B4.serialization.object({stepMetrics:B4.serialization.property("step_metrics",B4.serialization.list(mCr.TrainingStepMetrics).optional()),nextPageToken:B4.serialization.property("next_page_token",B4.serialization.string().optional())})});var u0e=b(ya=>{"use strict";var gCr=ya&&ya.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cc=ya&&ya.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gCr(e,t,r)};Object.defineProperty(ya,"__esModule",{value:!0});cc(e0e(),ya);cc(t0e(),ya);cc(r0e(),ya);cc(n0e(),ya);cc(o0e(),ya);cc(OX(),ya);cc(F4(),ya);cc(jF(),ya);cc(oht(),ya);cc(aht(),ya);cc(uht(),ya);cc(lht(),ya);cc(dht(),ya);cc(a0e(),ya);cc(fht(),ya);cc(s0e(),ya);cc(pht(),ya)});var hht=b(MI=>{"use strict";var yCr=MI&&MI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bCr=MI&&MI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yCr(e,t,r)};Object.defineProperty(MI,"__esModule",{value:!0});bCr(u0e(),MI)});var ght=b(Ep=>{"use strict";var mht=Ep&&Ep.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Cr=Ep&&Ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vCr=Ep&&Ep.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mht(e,t,r);return _Cr(e,t),e},wCr=Ep&&Ep.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mht(e,t,r)};Object.defineProperty(Ep,"__esModule",{value:!0});Ep.finetuning=void 0;Ep.finetuning=vCr(hht());wCr(u0e(),Ep)});var yht=b(Cv=>{"use strict";var SCr=Cv&&Cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xCr=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CCr=Cv&&Cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SCr(e,t,r);return xCr(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.FinetuningUpdateFinetunedModelRequest=void 0;var Pf=CCr($()),OCr=OX(),ECr=F4();Cv.FinetuningUpdateFinetunedModelRequest=Pf.serialization.object({name:Pf.serialization.string(),creatorId:Pf.serialization.property("creator_id",Pf.serialization.string().optional()),organizationId:Pf.serialization.property("organization_id",Pf.serialization.string().optional()),settings:OCr.Settings,status:ECr.Status.optional(),createdAt:Pf.serialization.property("created_at",Pf.serialization.date().optional()),updatedAt:Pf.serialization.property("updated_at",Pf.serialization.date().optional()),completedAt:Pf.serialization.property("completed_at",Pf.serialization.date().optional()),lastUsed:Pf.serialization.property("last_used",Pf.serialization.date().optional())})});var l0e=b(EX=>{"use strict";Object.defineProperty(EX,"__esModule",{value:!0});EX.FinetuningUpdateFinetunedModelRequest=void 0;var PCr=yht();Object.defineProperty(EX,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return PCr.FinetuningUpdateFinetunedModelRequest}})});var bht=b(AI=>{"use strict";var TCr=AI&&AI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MCr=AI&&AI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TCr(e,t,r)};Object.defineProperty(AI,"__esModule",{value:!0});MCr(l0e(),AI)});var vht=b(VP=>{"use strict";var ACr=VP&&VP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_ht=VP&&VP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ACr(e,t,r)};Object.defineProperty(VP,"__esModule",{value:!0});_ht(ght(),VP);_ht(bht(),VP)});var PX=b(Ev=>{"use strict";var RCr=Ev&&Ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ICr=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DCr=Ev&&Ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RCr(e,t,r);return ICr(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.CreateConnectorOAuth=void 0;var Ov=DCr($());Ev.CreateConnectorOAuth=Ov.serialization.object({clientId:Ov.serialization.property("client_id",Ov.serialization.string().optional()),clientSecret:Ov.serialization.property("client_secret",Ov.serialization.string().optional()),authorizeUrl:Ov.serialization.property("authorize_url",Ov.serialization.string().optional()),tokenUrl:Ov.serialization.property("token_url",Ov.serialization.string().optional()),scope:Ov.serialization.string().optional()})});var c0e=b(Pv=>{"use strict";var jCr=Pv&&Pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NCr=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LCr=Pv&&Pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jCr(e,t,r);return NCr(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.AuthTokenType=void 0;var FCr=LCr($());Pv.AuthTokenType=FCr.serialization.enum_(["bearer","basic","noscheme"])});var TX=b(Tv=>{"use strict";var kCr=Tv&&Tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BCr=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Cr=Tv&&Tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kCr(e,t,r);return BCr(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.CreateConnectorServiceAuth=void 0;var wht=$Cr($()),qCr=c0e();Tv.CreateConnectorServiceAuth=wht.serialization.object({type:qCr.AuthTokenType,token:wht.serialization.string()})});var Sht=b(Av=>{"use strict";var UCr=Av&&Av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zCr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HCr=Av&&Av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UCr(e,t,r);return zCr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.CreateConnectorRequest=void 0;var Mv=HCr($()),VCr=PX(),WCr=TX();Av.CreateConnectorRequest=Mv.serialization.object({name:Mv.serialization.string(),description:Mv.serialization.string().optional(),url:Mv.serialization.string(),excludes:Mv.serialization.list(Mv.serialization.string()).optional(),oauth:VCr.CreateConnectorOAuth.optional(),active:Mv.serialization.boolean().optional(),continueOnFailure:Mv.serialization.property("continue_on_failure",Mv.serialization.boolean().optional()),serviceAuth:Mv.serialization.property("service_auth",WCr.CreateConnectorServiceAuth.optional())})});var xht=b(Rv=>{"use strict";var JCr=Rv&&Rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GCr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KCr=Rv&&Rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JCr(e,t,r);return GCr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.UpdateConnectorRequest=void 0;var Qx=KCr($()),YCr=PX(),XCr=TX();Rv.UpdateConnectorRequest=Qx.serialization.object({name:Qx.serialization.string().optional(),url:Qx.serialization.string().optional(),excludes:Qx.serialization.list(Qx.serialization.string()).optional(),oauth:YCr.CreateConnectorOAuth.optional(),active:Qx.serialization.boolean().optional(),continueOnFailure:Qx.serialization.property("continue_on_failure",Qx.serialization.boolean().optional()),serviceAuth:Qx.serialization.property("service_auth",XCr.CreateConnectorServiceAuth.optional())})});var d0e=b(LF=>{"use strict";Object.defineProperty(LF,"__esModule",{value:!0});LF.UpdateConnectorRequest=LF.CreateConnectorRequest=void 0;var ZCr=Sht();Object.defineProperty(LF,"CreateConnectorRequest",{enumerable:!0,get:function(){return ZCr.CreateConnectorRequest}});var QCr=xht();Object.defineProperty(LF,"UpdateConnectorRequest",{enumerable:!0,get:function(){return QCr.UpdateConnectorRequest}})});var Cht=b(RI=>{"use strict";var eOr=RI&&RI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tOr=RI&&RI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eOr(e,t,r)};Object.defineProperty(RI,"__esModule",{value:!0});tOr(d0e(),RI)});var Oht=b(II=>{"use strict";var rOr=II&&II.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nOr=II&&II.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rOr(e,t,r)};Object.defineProperty(II,"__esModule",{value:!0});nOr(Cht(),II)});var Pht=b(ei=>{"use strict";var Eht=ei&&ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oOr=ei&&ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=ei&&ei.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Eht(e,t,r);return oOr(e,t),e},DI=ei&&ei.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Eht(e,t,r)};Object.defineProperty(ei,"__esModule",{value:!0});ei.connectors=ei.finetuning=ei.datasets=ei.embedJobs=ei.v2=void 0;ei.v2=$4(Upt());DI(Uve(),ei);ei.embedJobs=$4(Wpt());DI(Wve(),ei);ei.datasets=$4(nht());DI(Zve(),ei);ei.finetuning=$4(vht());DI(Hve(),ei);DI(Jve(),ei);ei.connectors=$4(Oht());DI(d0e(),ei);DI(l0e(),ei)});var f0e=b(Iv=>{"use strict";var iOr=Iv&&Iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aOr=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sOr=Iv&&Iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iOr(e,t,r);return aOr(e,t),e};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.ChatStreamRequestPromptTruncation=void 0;var uOr=sOr($());Iv.ChatStreamRequestPromptTruncation=uOr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var p0e=b(Dv=>{"use strict";var lOr=Dv&&Dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cOr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dOr=Dv&&Dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lOr(e,t,r);return cOr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ChatStreamRequestCitationQuality=void 0;var fOr=dOr($());Dv.ChatStreamRequestCitationQuality=fOr.serialization.enum_(["fast","accurate","off"])});var Mht=b(jv=>{"use strict";var pOr=jv&&jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hOr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mOr=jv&&jv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pOr(e,t,r);return hOr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.ChatStreamRequestConnectorsSearchOptions=void 0;var Tht=mOr($());jv.ChatStreamRequestConnectorsSearchOptions=Tht.serialization.object({seed:Tht.serialization.number().optional()})});var h0e=b(Nv=>{"use strict";var gOr=Nv&&Nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yOr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bOr=Nv&&Nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gOr(e,t,r);return yOr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.ChatStreamRequestSafetyMode=void 0;var _Or=bOr($());Nv.ChatStreamRequestSafetyMode=_Or.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var Rht=b(Lv=>{"use strict";var vOr=Lv&&Lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wOr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SOr=Lv&&Lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vOr(e,t,r);return wOr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.UnprocessableEntityErrorBody=void 0;var Aht=SOr($());Lv.UnprocessableEntityErrorBody=Aht.serialization.object({data:Aht.serialization.string().optional()})});var Dht=b(Fv=>{"use strict";var xOr=Fv&&Fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),COr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OOr=Fv&&Fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xOr(e,t,r);return COr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.TooManyRequestsErrorBody=void 0;var Iht=OOr($());Fv.TooManyRequestsErrorBody=Iht.serialization.object({data:Iht.serialization.string().optional()})});var Nht=b(kv=>{"use strict";var EOr=kv&&kv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),POr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TOr=kv&&kv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EOr(e,t,r);return POr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.ClientClosedRequestErrorBody=void 0;var jht=TOr($());kv.ClientClosedRequestErrorBody=jht.serialization.object({data:jht.serialization.string().optional()})});var Fht=b(Bv=>{"use strict";var MOr=Bv&&Bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AOr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ROr=Bv&&Bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MOr(e,t,r);return AOr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.NotImplementedErrorBody=void 0;var Lht=ROr($());Bv.NotImplementedErrorBody=Lht.serialization.object({data:Lht.serialization.string().optional()})});var Bht=b($v=>{"use strict";var IOr=$v&&$v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DOr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jOr=$v&&$v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IOr(e,t,r);return DOr(e,t),e};Object.defineProperty($v,"__esModule",{value:!0});$v.GatewayTimeoutErrorBody=void 0;var kht=jOr($());$v.GatewayTimeoutErrorBody=kht.serialization.object({data:kht.serialization.string().optional()})});var m0e=b(qv=>{"use strict";var NOr=qv&&qv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LOr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FOr=qv&&qv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NOr(e,t,r);return LOr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.ChatRequestPromptTruncation=void 0;var kOr=FOr($());qv.ChatRequestPromptTruncation=kOr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var g0e=b(Uv=>{"use strict";var BOr=Uv&&Uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Or=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qOr=Uv&&Uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BOr(e,t,r);return $Or(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ChatRequestCitationQuality=void 0;var UOr=qOr($());Uv.ChatRequestCitationQuality=UOr.serialization.enum_(["fast","accurate","off"])});var qht=b(zv=>{"use strict";var zOr=zv&&zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HOr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VOr=zv&&zv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zOr(e,t,r);return HOr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.ChatRequestConnectorsSearchOptions=void 0;var $ht=VOr($());zv.ChatRequestConnectorsSearchOptions=$ht.serialization.object({seed:$ht.serialization.number().optional()})});var y0e=b(Hv=>{"use strict";var WOr=Hv&&Hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JOr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GOr=Hv&&Hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WOr(e,t,r);return JOr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.ChatRequestSafetyMode=void 0;var KOr=GOr($());Hv.ChatRequestSafetyMode=KOr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var b0e=b(Vv=>{"use strict";var YOr=Vv&&Vv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XOr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZOr=Vv&&Vv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YOr(e,t,r);return XOr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.GenerateStreamRequestTruncate=void 0;var QOr=ZOr($());Vv.GenerateStreamRequestTruncate=QOr.serialization.enum_(["NONE","START","END"])});var _0e=b(Wv=>{"use strict";var eEr=Wv&&Wv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tEr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rEr=Wv&&Wv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eEr(e,t,r);return tEr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.GenerateStreamRequestReturnLikelihoods=void 0;var nEr=rEr($());Wv.GenerateStreamRequestReturnLikelihoods=nEr.serialization.enum_(["GENERATION","ALL","NONE"])});var v0e=b(Jv=>{"use strict";var oEr=Jv&&Jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iEr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aEr=Jv&&Jv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oEr(e,t,r);return iEr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.GenerateRequestTruncate=void 0;var sEr=aEr($());Jv.GenerateRequestTruncate=sEr.serialization.enum_(["NONE","START","END"])});var w0e=b(Gv=>{"use strict";var uEr=Gv&&Gv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lEr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cEr=Gv&&Gv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uEr(e,t,r);return lEr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.GenerateRequestReturnLikelihoods=void 0;var dEr=cEr($());Gv.GenerateRequestReturnLikelihoods=dEr.serialization.enum_(["GENERATION","ALL","NONE"])});var S0e=b(Kv=>{"use strict";var fEr=Kv&&Kv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pEr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hEr=Kv&&Kv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fEr(e,t,r);return pEr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.EmbedRequestTruncate=void 0;var mEr=hEr($());Kv.EmbedRequestTruncate=mEr.serialization.enum_(["NONE","START","END"])});var x0e=b(Yv=>{"use strict";var gEr=Yv&&Yv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yEr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bEr=Yv&&Yv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gEr(e,t,r);return yEr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ApiMetaApiVersion=void 0;var FF=bEr($());Yv.ApiMetaApiVersion=FF.serialization.object({version:FF.serialization.string(),isDeprecated:FF.serialization.property("is_deprecated",FF.serialization.boolean().optional()),isExperimental:FF.serialization.property("is_experimental",FF.serialization.boolean().optional())})});var C0e=b(Xv=>{"use strict";var _Er=Xv&&Xv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vEr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wEr=Xv&&Xv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Er(e,t,r);return vEr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ApiMetaBilledUnits=void 0;var WP=wEr($());Xv.ApiMetaBilledUnits=WP.serialization.object({inputTokens:WP.serialization.property("input_tokens",WP.serialization.number().optional()),outputTokens:WP.serialization.property("output_tokens",WP.serialization.number().optional()),searchUnits:WP.serialization.property("search_units",WP.serialization.number().optional()),classifications:WP.serialization.number().optional()})});var O0e=b(Zv=>{"use strict";var SEr=Zv&&Zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xEr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CEr=Zv&&Zv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SEr(e,t,r);return xEr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ApiMetaTokens=void 0;var q4=CEr($());Zv.ApiMetaTokens=q4.serialization.object({inputTokens:q4.serialization.property("input_tokens",q4.serialization.number().optional()),outputTokens:q4.serialization.property("output_tokens",q4.serialization.number().optional())})});var Pp=b(Qv=>{"use strict";var OEr=Qv&&Qv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EEr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PEr=Qv&&Qv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OEr(e,t,r);return EEr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ApiMeta=void 0;var U4=PEr($()),TEr=x0e(),MEr=C0e(),AEr=O0e();Qv.ApiMeta=U4.serialization.object({apiVersion:U4.serialization.property("api_version",TEr.ApiMetaApiVersion.optional()),billedUnits:U4.serialization.property("billed_units",MEr.ApiMetaBilledUnits.optional()),tokens:AEr.ApiMetaTokens.optional(),warnings:U4.serialization.list(U4.serialization.string()).optional()})});var E0e=b(e0=>{"use strict";var REr=e0&&e0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IEr=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DEr=e0&&e0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&REr(e,t,r);return IEr(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.EmbedFloatsResponse=void 0;var jI=DEr($()),jEr=Pp();e0.EmbedFloatsResponse=jI.serialization.object({id:jI.serialization.string(),embeddings:jI.serialization.list(jI.serialization.list(jI.serialization.number())),texts:jI.serialization.list(jI.serialization.string()),meta:jEr.ApiMeta.optional()})});var P0e=b(t0=>{"use strict";var NEr=t0&&t0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LEr=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FEr=t0&&t0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NEr(e,t,r);return LEr(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.EmbedByTypeResponseEmbeddings=void 0;var ad=FEr($());t0.EmbedByTypeResponseEmbeddings=ad.serialization.object({float:ad.serialization.list(ad.serialization.list(ad.serialization.number())).optional(),int8:ad.serialization.list(ad.serialization.list(ad.serialization.number())).optional(),uint8:ad.serialization.list(ad.serialization.list(ad.serialization.number())).optional(),binary:ad.serialization.list(ad.serialization.list(ad.serialization.number())).optional(),ubinary:ad.serialization.list(ad.serialization.list(ad.serialization.number())).optional()})});var T0e=b(r0=>{"use strict";var kEr=r0&&r0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BEr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Er=r0&&r0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kEr(e,t,r);return BEr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.EmbedByTypeResponse=void 0;var MX=$Er($()),qEr=P0e(),UEr=Pp();r0.EmbedByTypeResponse=MX.serialization.object({id:MX.serialization.string(),embeddings:qEr.EmbedByTypeResponseEmbeddings,texts:MX.serialization.list(MX.serialization.string()),meta:UEr.ApiMeta.optional()})});var zht=b(n0=>{"use strict";var zEr=n0&&n0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HEr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VEr=n0&&n0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zEr(e,t,r);return HEr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.EmbedResponse=void 0;var Uht=VEr($()),WEr=E0e(),JEr=T0e();n0.EmbedResponse=Uht.serialization.union(Uht.serialization.discriminant("responseType","response_type"),{embeddings_floats:WEr.EmbedFloatsResponse,embeddings_by_type:JEr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var A0e=b(o0=>{"use strict";var GEr=o0&&o0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KEr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEr=o0&&o0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GEr(e,t,r);return KEr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.RerankDocument=void 0;var M0e=YEr($());o0.RerankDocument=M0e.serialization.record(M0e.serialization.string(),M0e.serialization.string())});var R0e=b(i0=>{"use strict";var XEr=i0&&i0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZEr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QEr=i0&&i0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XEr(e,t,r);return ZEr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.RerankRequestDocumentsItem=void 0;var Hht=QEr($()),ePr=A0e();i0.RerankRequestDocumentsItem=Hht.serialization.undiscriminatedUnion([Hht.serialization.string(),ePr.RerankDocument])});var I0e=b(a0=>{"use strict";var tPr=a0&&a0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rPr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nPr=a0&&a0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tPr(e,t,r);return rPr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.RerankResponseResultsItemDocument=void 0;var Vht=nPr($());a0.RerankResponseResultsItemDocument=Vht.serialization.object({text:Vht.serialization.string()})});var D0e=b(s0=>{"use strict";var oPr=s0&&s0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iPr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aPr=s0&&s0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oPr(e,t,r);return iPr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.RerankResponseResultsItem=void 0;var AX=aPr($()),sPr=I0e();s0.RerankResponseResultsItem=AX.serialization.object({document:sPr.RerankResponseResultsItemDocument.optional(),index:AX.serialization.number(),relevanceScore:AX.serialization.property("relevance_score",AX.serialization.number())})});var Wht=b(u0=>{"use strict";var uPr=u0&&u0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lPr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cPr=u0&&u0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uPr(e,t,r);return lPr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.RerankResponse=void 0;var j0e=cPr($()),dPr=D0e(),fPr=Pp();u0.RerankResponse=j0e.serialization.object({id:j0e.serialization.string().optional(),results:j0e.serialization.list(dPr.RerankResponseResultsItem),meta:fPr.ApiMeta.optional()})});var N0e=b(l0=>{"use strict";var pPr=l0&&l0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hPr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mPr=l0&&l0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pPr(e,t,r);return hPr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ClassifyRequestTruncate=void 0;var gPr=mPr($());l0.ClassifyRequestTruncate=gPr.serialization.enum_(["NONE","START","END"])});var L0e=b(c0=>{"use strict";var yPr=c0&&c0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bPr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Pr=c0&&c0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yPr(e,t,r);return bPr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ClassifyResponseClassificationsItemLabelsValue=void 0;var Jht=_Pr($());c0.ClassifyResponseClassificationsItemLabelsValue=Jht.serialization.object({confidence:Jht.serialization.number().optional()})});var F0e=b(d0=>{"use strict";var vPr=d0&&d0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wPr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SPr=d0&&d0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vPr(e,t,r);return wPr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.ClassifyResponseClassificationsItemClassificationType=void 0;var xPr=SPr($());d0.ClassifyResponseClassificationsItemClassificationType=xPr.serialization.enum_(["single-label","multi-label"])});var k0e=b(f0=>{"use strict";var CPr=f0&&f0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OPr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EPr=f0&&f0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CPr(e,t,r);return OPr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.ClassifyResponseClassificationsItem=void 0;var zh=EPr($()),PPr=L0e(),TPr=F0e();f0.ClassifyResponseClassificationsItem=zh.serialization.object({id:zh.serialization.string(),input:zh.serialization.string().optional(),prediction:zh.serialization.string().optional(),predictions:zh.serialization.list(zh.serialization.string()),confidence:zh.serialization.number().optional(),confidences:zh.serialization.list(zh.serialization.number()),labels:zh.serialization.record(zh.serialization.string(),PPr.ClassifyResponseClassificationsItemLabelsValue),classificationType:zh.serialization.property("classification_type",TPr.ClassifyResponseClassificationsItemClassificationType)})});var Ght=b(p0=>{"use strict";var MPr=p0&&p0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),APr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RPr=p0&&p0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MPr(e,t,r);return APr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.ClassifyResponse=void 0;var B0e=RPr($()),IPr=k0e(),DPr=Pp();p0.ClassifyResponse=B0e.serialization.object({id:B0e.serialization.string(),classifications:B0e.serialization.list(IPr.ClassifyResponseClassificationsItem),meta:DPr.ApiMeta.optional()})});var $0e=b(h0=>{"use strict";var jPr=h0&&h0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NPr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LPr=h0&&h0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jPr(e,t,r);return NPr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.SummarizeRequestLength=void 0;var FPr=LPr($());h0.SummarizeRequestLength=FPr.serialization.enum_(["short","medium","long"])});var q0e=b(m0=>{"use strict";var kPr=m0&&m0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BPr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Pr=m0&&m0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kPr(e,t,r);return BPr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.SummarizeRequestFormat=void 0;var qPr=$Pr($());m0.SummarizeRequestFormat=qPr.serialization.enum_(["paragraph","bullets"])});var U0e=b(g0=>{"use strict";var UPr=g0&&g0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zPr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HPr=g0&&g0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UPr(e,t,r);return zPr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.SummarizeRequestExtractiveness=void 0;var VPr=HPr($());g0.SummarizeRequestExtractiveness=VPr.serialization.enum_(["low","medium","high"])});var Kht=b(y0=>{"use strict";var WPr=y0&&y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JPr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GPr=y0&&y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WPr(e,t,r);return JPr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.SummarizeResponse=void 0;var z0e=GPr($()),KPr=Pp();y0.SummarizeResponse=z0e.serialization.object({id:z0e.serialization.string().optional(),summary:z0e.serialization.string().optional(),meta:KPr.ApiMeta.optional()})});var Yht=b(b0=>{"use strict";var YPr=b0&&b0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XPr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZPr=b0&&b0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YPr(e,t,r);return XPr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.TokenizeResponse=void 0;var kF=ZPr($()),QPr=Pp();b0.TokenizeResponse=kF.serialization.object({tokens:kF.serialization.list(kF.serialization.number()),tokenStrings:kF.serialization.property("token_strings",kF.serialization.list(kF.serialization.string())),meta:QPr.ApiMeta.optional()})});var Zht=b(_0=>{"use strict";var eTr=_0&&_0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tTr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rTr=_0&&_0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eTr(e,t,r);return tTr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.DetokenizeResponse=void 0;var Xht=rTr($()),nTr=Pp();_0.DetokenizeResponse=Xht.serialization.object({text:Xht.serialization.string(),meta:nTr.ApiMeta.optional()})});var Qht=b(v0=>{"use strict";var oTr=v0&&v0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iTr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aTr=v0&&v0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oTr(e,t,r);return iTr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.CheckApiKeyResponse=void 0;var BF=aTr($());v0.CheckApiKeyResponse=BF.serialization.object({valid:BF.serialization.boolean(),organizationId:BF.serialization.property("organization_id",BF.serialization.string().optional()),ownerId:BF.serialization.property("owner_id",BF.serialization.string().optional())})});var $F=b(w0=>{"use strict";var sTr=w0&&w0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uTr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lTr=w0&&w0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sTr(e,t,r);return uTr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.ToolCall=void 0;var z4=lTr($());w0.ToolCall=z4.serialization.object({name:z4.serialization.string(),parameters:z4.serialization.record(z4.serialization.string(),z4.serialization.unknown())})});var H0e=b(S0=>{"use strict";var cTr=S0&&S0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dTr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fTr=S0&&S0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cTr(e,t,r);return dTr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatMessage=void 0;var RX=fTr($()),pTr=$F();S0.ChatMessage=RX.serialization.object({message:RX.serialization.string(),toolCalls:RX.serialization.property("tool_calls",RX.serialization.list(pTr.ToolCall).optional())})});var V4=b(x0=>{"use strict";var hTr=x0&&x0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mTr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTr=x0&&x0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hTr(e,t,r);return mTr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ToolResult=void 0;var H4=gTr($()),yTr=$F();x0.ToolResult=H4.serialization.object({call:yTr.ToolCall,outputs:H4.serialization.list(H4.serialization.record(H4.serialization.string(),H4.serialization.unknown()))})});var W0e=b(C0=>{"use strict";var bTr=C0&&C0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Tr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vTr=C0&&C0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bTr(e,t,r);return _Tr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.ToolMessage=void 0;var V0e=vTr($()),wTr=V4();C0.ToolMessage=V0e.serialization.object({toolResults:V0e.serialization.property("tool_results",V0e.serialization.list(wTr.ToolResult).optional())})});var W4=b(O0=>{"use strict";var STr=O0&&O0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xTr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CTr=O0&&O0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&STr(e,t,r);return xTr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.Message=void 0;var OTr=CTr($()),J0e=H0e(),ETr=W0e();O0.Message=OTr.serialization.union("role",{CHATBOT:J0e.ChatMessage,SYSTEM:J0e.ChatMessage,USER:J0e.ChatMessage,TOOL:ETr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var IX=b(E0=>{"use strict";var PTr=E0&&E0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TTr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MTr=E0&&E0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PTr(e,t,r);return TTr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ChatConnector=void 0;var eC=MTr($());E0.ChatConnector=eC.serialization.object({id:eC.serialization.string(),userAccessToken:eC.serialization.property("user_access_token",eC.serialization.string().optional()),continueOnFailure:eC.serialization.property("continue_on_failure",eC.serialization.boolean().optional()),options:eC.serialization.record(eC.serialization.string(),eC.serialization.unknown()).optional()})});var G0e=b(P0=>{"use strict";var ATr=P0&&P0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RTr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ITr=P0&&P0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ATr(e,t,r);return RTr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.ToolParameterDefinitionsValue=void 0;var DX=ITr($());P0.ToolParameterDefinitionsValue=DX.serialization.object({description:DX.serialization.string().optional(),type:DX.serialization.string(),required:DX.serialization.boolean().optional()})});var jX=b(T0=>{"use strict";var DTr=T0&&T0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jTr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NTr=T0&&T0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DTr(e,t,r);return jTr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.Tool=void 0;var qF=NTr($()),LTr=G0e();T0.Tool=qF.serialization.object({name:qF.serialization.string(),description:qF.serialization.string(),parameterDefinitions:qF.serialization.property("parameter_definitions",qF.serialization.record(qF.serialization.string(),LTr.ToolParameterDefinitionsValue).optional())})});var K0e=b(M0=>{"use strict";var FTr=M0&&M0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kTr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BTr=M0&&M0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FTr(e,t,r);return kTr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.JsonResponseFormat=void 0;var NX=BTr($());M0.JsonResponseFormat=NX.serialization.object({schema:NX.serialization.record(NX.serialization.string(),NX.serialization.unknown()).optional()})});var LX=b(A0=>{"use strict";var $Tr=A0&&A0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qTr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UTr=A0&&A0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Tr(e,t,r);return qTr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ResponseFormat=void 0;var zTr=UTr($()),HTr=bX(),VTr=K0e();A0.ResponseFormat=zTr.serialization.union("type",{text:HTr.TextResponseFormat,json_object:VTr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var FX=b(R0=>{"use strict";var WTr=R0&&R0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JTr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GTr=R0&&R0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WTr(e,t,r);return JTr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ChatCitation=void 0;var NI=GTr($());R0.ChatCitation=NI.serialization.object({start:NI.serialization.number(),end:NI.serialization.number(),text:NI.serialization.string(),documentIds:NI.serialization.property("document_ids",NI.serialization.list(NI.serialization.string()))})});var J4=b(I0=>{"use strict";var KTr=I0&&I0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YTr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XTr=I0&&I0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KTr(e,t,r);return YTr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ChatSearchQuery=void 0;var kX=XTr($());I0.ChatSearchQuery=kX.serialization.object({text:kX.serialization.string(),generationId:kX.serialization.property("generation_id",kX.serialization.string())})});var Y0e=b(D0=>{"use strict";var ZTr=D0&&D0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QTr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eMr=D0&&D0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZTr(e,t,r);return QTr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.ChatSearchResultConnector=void 0;var emt=eMr($());D0.ChatSearchResultConnector=emt.serialization.object({id:emt.serialization.string()})});var BX=b(j0=>{"use strict";var tMr=j0&&j0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rMr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nMr=j0&&j0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tMr(e,t,r);return rMr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ChatSearchResult=void 0;var tC=nMr($()),oMr=J4(),iMr=Y0e();j0.ChatSearchResult=tC.serialization.object({searchQuery:tC.serialization.property("search_query",oMr.ChatSearchQuery.optional()),connector:iMr.ChatSearchResultConnector,documentIds:tC.serialization.property("document_ids",tC.serialization.list(tC.serialization.string())),errorMessage:tC.serialization.property("error_message",tC.serialization.string().optional()),continueOnFailure:tC.serialization.property("continue_on_failure",tC.serialization.boolean().optional())})});var UF=b(N0=>{"use strict";var aMr=N0&&N0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sMr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uMr=N0&&N0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aMr(e,t,r);return sMr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.FinishReason=void 0;var lMr=uMr($());N0.FinishReason=lMr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var X0e=b(L0=>{"use strict";var cMr=L0&&L0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dMr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fMr=L0&&L0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cMr(e,t,r);return dMr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.NonStreamedChatResponse=void 0;var Ml=fMr($()),pMr=FX(),hMr=CI(),mMr=J4(),gMr=BX(),yMr=UF(),bMr=$F(),_Mr=W4(),vMr=Pp();L0.NonStreamedChatResponse=Ml.serialization.object({text:Ml.serialization.string(),generationId:Ml.serialization.property("generation_id",Ml.serialization.string().optional()),citations:Ml.serialization.list(pMr.ChatCitation).optional(),documents:Ml.serialization.list(hMr.ChatDocument).optional(),isSearchRequired:Ml.serialization.property("is_search_required",Ml.serialization.boolean().optional()),searchQueries:Ml.serialization.property("search_queries",Ml.serialization.list(mMr.ChatSearchQuery).optional()),searchResults:Ml.serialization.property("search_results",Ml.serialization.list(gMr.ChatSearchResult).optional()),finishReason:Ml.serialization.property("finish_reason",yMr.FinishReason.optional()),toolCalls:Ml.serialization.property("tool_calls",Ml.serialization.list(bMr.ToolCall).optional()),chatHistory:Ml.serialization.property("chat_history",Ml.serialization.list(_Mr.Message).optional()),prompt:Ml.serialization.string().optional(),meta:vMr.ApiMeta.optional()})});var k0=b(F0=>{"use strict";var wMr=F0&&F0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SMr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xMr=F0&&F0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wMr(e,t,r);return SMr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.ChatStreamEvent=void 0;var CMr=xMr($());F0.ChatStreamEvent=CMr.serialization.object({})});var Q0e=b(B0=>{"use strict";var OMr=B0&&B0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EMr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PMr=B0&&B0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OMr(e,t,r);return EMr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.ChatStreamStartEvent=void 0;var Z0e=PMr($()),TMr=k0();B0.ChatStreamStartEvent=Z0e.serialization.object({generationId:Z0e.serialization.property("generation_id",Z0e.serialization.string())}).extend(TMr.ChatStreamEvent)});var twe=b($0=>{"use strict";var MMr=$0&&$0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AMr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RMr=$0&&$0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MMr(e,t,r);return AMr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.ChatSearchQueriesGenerationEvent=void 0;var ewe=RMr($()),IMr=J4(),DMr=k0();$0.ChatSearchQueriesGenerationEvent=ewe.serialization.object({searchQueries:ewe.serialization.property("search_queries",ewe.serialization.list(IMr.ChatSearchQuery))}).extend(DMr.ChatStreamEvent)});var rwe=b(q0=>{"use strict";var jMr=q0&&q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NMr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LMr=q0&&q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jMr(e,t,r);return NMr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.ChatSearchResultsEvent=void 0;var $X=LMr($()),FMr=BX(),kMr=CI(),BMr=k0();q0.ChatSearchResultsEvent=$X.serialization.object({searchResults:$X.serialization.property("search_results",$X.serialization.list(FMr.ChatSearchResult).optional()),documents:$X.serialization.list(kMr.ChatDocument).optional()}).extend(BMr.ChatStreamEvent)});var nwe=b(U0=>{"use strict";var $Mr=U0&&U0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qMr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UMr=U0&&U0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Mr(e,t,r);return qMr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ChatTextGenerationEvent=void 0;var tmt=UMr($()),zMr=k0();U0.ChatTextGenerationEvent=tmt.serialization.object({text:tmt.serialization.string()}).extend(zMr.ChatStreamEvent)});var owe=b(z0=>{"use strict";var HMr=z0&&z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VMr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WMr=z0&&z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HMr(e,t,r);return VMr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ChatCitationGenerationEvent=void 0;var rmt=WMr($()),JMr=FX(),GMr=k0();z0.ChatCitationGenerationEvent=rmt.serialization.object({citations:rmt.serialization.list(JMr.ChatCitation)}).extend(GMr.ChatStreamEvent)});var iwe=b(H0=>{"use strict";var KMr=H0&&H0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YMr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XMr=H0&&H0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KMr(e,t,r);return YMr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ChatToolCallsGenerationEvent=void 0;var qX=XMr($()),ZMr=$F(),QMr=k0();H0.ChatToolCallsGenerationEvent=qX.serialization.object({text:qX.serialization.string().optional(),toolCalls:qX.serialization.property("tool_calls",qX.serialization.list(ZMr.ToolCall))}).extend(QMr.ChatStreamEvent)});var awe=b(V0=>{"use strict";var eAr=V0&&V0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tAr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rAr=V0&&V0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eAr(e,t,r);return tAr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.ChatStreamEndEventFinishReason=void 0;var nAr=rAr($());V0.ChatStreamEndEventFinishReason=nAr.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var swe=b(W0=>{"use strict";var oAr=W0&&W0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iAr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aAr=W0&&W0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oAr(e,t,r);return iAr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.ChatStreamEndEvent=void 0;var nmt=aAr($()),sAr=awe(),uAr=X0e(),lAr=k0();W0.ChatStreamEndEvent=nmt.serialization.object({finishReason:nmt.serialization.property("finish_reason",sAr.ChatStreamEndEventFinishReason),response:uAr.NonStreamedChatResponse}).extend(lAr.ChatStreamEvent)});var uwe=b(J0=>{"use strict";var cAr=J0&&J0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dAr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fAr=J0&&J0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cAr(e,t,r);return dAr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.ToolCallDelta=void 0;var G4=fAr($());J0.ToolCallDelta=G4.serialization.object({name:G4.serialization.string().optional(),index:G4.serialization.number().optional(),parameters:G4.serialization.string().optional(),text:G4.serialization.string().optional()})});var lwe=b(G0=>{"use strict";var pAr=G0&&G0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hAr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAr=G0&&G0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pAr(e,t,r);return hAr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.ChatToolCallsChunkEvent=void 0;var omt=mAr($()),gAr=uwe(),yAr=k0();G0.ChatToolCallsChunkEvent=omt.serialization.object({toolCallDelta:omt.serialization.property("tool_call_delta",gAr.ToolCallDelta)}).extend(yAr.ChatStreamEvent)});var amt=b(K0=>{"use strict";var bAr=K0&&K0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Ar=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vAr=K0&&K0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bAr(e,t,r);return _Ar(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.StreamedChatResponse=void 0;var imt=vAr($()),wAr=Q0e(),SAr=twe(),xAr=rwe(),CAr=nwe(),OAr=owe(),EAr=iwe(),PAr=swe(),TAr=lwe();K0.StreamedChatResponse=imt.serialization.union(imt.serialization.discriminant("eventType","event_type"),{"stream-start":wAr.ChatStreamStartEvent,"search-queries-generation":SAr.ChatSearchQueriesGenerationEvent,"search-results":xAr.ChatSearchResultsEvent,"text-generation":CAr.ChatTextGenerationEvent,"citation-generation":OAr.ChatCitationGenerationEvent,"tool-calls-generation":EAr.ChatToolCallsGenerationEvent,"stream-end":PAr.ChatStreamEndEvent,"tool-calls-chunk":TAr.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var dwe=b(Y0=>{"use strict";var MAr=Y0&&Y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AAr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RAr=Y0&&Y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MAr(e,t,r);return AAr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.SingleGenerationTokenLikelihoodsItem=void 0;var cwe=RAr($());Y0.SingleGenerationTokenLikelihoodsItem=cwe.serialization.object({token:cwe.serialization.string(),likelihood:cwe.serialization.number()})});var fwe=b(X0=>{"use strict";var IAr=X0&&X0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DAr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jAr=X0&&X0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IAr(e,t,r);return DAr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.SingleGeneration=void 0;var LI=jAr($()),NAr=dwe();X0.SingleGeneration=LI.serialization.object({id:LI.serialization.string(),text:LI.serialization.string(),index:LI.serialization.number().optional(),likelihood:LI.serialization.number().optional(),tokenLikelihoods:LI.serialization.property("token_likelihoods",LI.serialization.list(NAr.SingleGenerationTokenLikelihoodsItem).optional())})});var smt=b(Z0=>{"use strict";var LAr=Z0&&Z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FAr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kAr=Z0&&Z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LAr(e,t,r);return FAr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.Generation=void 0;var UX=kAr($()),BAr=fwe(),$Ar=Pp();Z0.Generation=UX.serialization.object({id:UX.serialization.string(),prompt:UX.serialization.string().optional(),generations:UX.serialization.list(BAr.SingleGeneration),meta:$Ar.ApiMeta.optional()})});var K4=b(Q0=>{"use strict";var qAr=Q0&&Q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UAr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zAr=Q0&&Q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qAr(e,t,r);return UAr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.GenerateStreamEvent=void 0;var HAr=zAr($());Q0.GenerateStreamEvent=HAr.serialization.object({})});var pwe=b(ew=>{"use strict";var VAr=ew&&ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WAr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAr=ew&&ew.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VAr(e,t,r);return WAr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.GenerateStreamText=void 0;var Y4=JAr($()),GAr=K4();ew.GenerateStreamText=Y4.serialization.object({text:Y4.serialization.string(),index:Y4.serialization.number().optional(),isFinished:Y4.serialization.property("is_finished",Y4.serialization.boolean())}).extend(GAr.GenerateStreamEvent)});var hwe=b(tw=>{"use strict";var KAr=tw&&tw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YAr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XAr=tw&&tw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KAr(e,t,r);return YAr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.SingleGenerationInStream=void 0;var X4=XAr($()),ZAr=UF();tw.SingleGenerationInStream=X4.serialization.object({id:X4.serialization.string(),text:X4.serialization.string(),index:X4.serialization.number().optional(),finishReason:X4.serialization.property("finish_reason",ZAr.FinishReason)})});var mwe=b(rw=>{"use strict";var QAr=rw&&rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eRr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tRr=rw&&rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QAr(e,t,r);return eRr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.GenerateStreamEndResponse=void 0;var zX=tRr($()),rRr=hwe();rw.GenerateStreamEndResponse=zX.serialization.object({id:zX.serialization.string(),prompt:zX.serialization.string().optional(),generations:zX.serialization.list(rRr.SingleGenerationInStream).optional()})});var gwe=b(nw=>{"use strict";var nRr=nw&&nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oRr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iRr=nw&&nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nRr(e,t,r);return oRr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.GenerateStreamEnd=void 0;var HX=iRr($()),aRr=UF(),sRr=mwe(),uRr=K4();nw.GenerateStreamEnd=HX.serialization.object({isFinished:HX.serialization.property("is_finished",HX.serialization.boolean()),finishReason:HX.serialization.property("finish_reason",aRr.FinishReason.optional()),response:sRr.GenerateStreamEndResponse}).extend(uRr.GenerateStreamEvent)});var ywe=b(ow=>{"use strict";var lRr=ow&&ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cRr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dRr=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lRr(e,t,r);return cRr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.GenerateStreamError=void 0;var zF=dRr($()),fRr=UF(),pRr=K4();ow.GenerateStreamError=zF.serialization.object({index:zF.serialization.number().optional(),isFinished:zF.serialization.property("is_finished",zF.serialization.boolean()),finishReason:zF.serialization.property("finish_reason",fRr.FinishReason),err:zF.serialization.string()}).extend(pRr.GenerateStreamEvent)});var lmt=b(iw=>{"use strict";var hRr=iw&&iw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mRr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gRr=iw&&iw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hRr(e,t,r);return mRr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.GenerateStreamedResponse=void 0;var umt=gRr($()),yRr=pwe(),bRr=gwe(),_Rr=ywe();iw.GenerateStreamedResponse=umt.serialization.union(umt.serialization.discriminant("eventType","event_type"),{"text-generation":yRr.GenerateStreamText,"stream-end":bRr.GenerateStreamEnd,"stream-error":_Rr.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var bwe=b(aw=>{"use strict";var vRr=aw&&aw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wRr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRr=aw&&aw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vRr(e,t,r);return wRr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.EmbedJobStatus=void 0;var xRr=SRr($());aw.EmbedJobStatus=xRr.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var _we=b(sw=>{"use strict";var CRr=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ORr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ERr=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CRr(e,t,r);return ORr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.EmbedJobTruncate=void 0;var PRr=ERr($());sw.EmbedJobTruncate=PRr.serialization.enum_(["START","END"])});var vwe=b(uw=>{"use strict";var TRr=uw&&uw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MRr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ARr=uw&&uw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TRr(e,t,r);return MRr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.EmbedJob=void 0;var Pg=ARr($()),RRr=bwe(),IRr=_we(),DRr=Pp();uw.EmbedJob=Pg.serialization.object({jobId:Pg.serialization.property("job_id",Pg.serialization.string()),name:Pg.serialization.string().optional(),status:RRr.EmbedJobStatus,createdAt:Pg.serialization.property("created_at",Pg.serialization.date()),inputDatasetId:Pg.serialization.property("input_dataset_id",Pg.serialization.string()),outputDatasetId:Pg.serialization.property("output_dataset_id",Pg.serialization.string().optional()),model:Pg.serialization.string(),truncate:IRr.EmbedJobTruncate,meta:DRr.ApiMeta.optional()})});var cmt=b(lw=>{"use strict";var jRr=lw&&lw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NRr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LRr=lw&&lw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jRr(e,t,r);return NRr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ListEmbedJobResponse=void 0;var wwe=LRr($()),FRr=vwe();lw.ListEmbedJobResponse=wwe.serialization.object({embedJobs:wwe.serialization.property("embed_jobs",wwe.serialization.list(FRr.EmbedJob).optional())})});var dmt=b(cw=>{"use strict";var kRr=cw&&cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BRr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Rr=cw&&cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kRr(e,t,r);return BRr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.CreateEmbedJobResponse=void 0;var Swe=$Rr($()),qRr=Pp();cw.CreateEmbedJobResponse=Swe.serialization.object({jobId:Swe.serialization.property("job_id",Swe.serialization.string()),meta:qRr.ApiMeta.optional()})});var Cwe=b(dw=>{"use strict";var URr=dw&&dw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zRr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HRr=dw&&dw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&URr(e,t,r);return zRr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.ClassifyExample=void 0;var xwe=HRr($());dw.ClassifyExample=xwe.serialization.object({text:xwe.serialization.string().optional(),label:xwe.serialization.string().optional()})});var fmt=b(fw=>{"use strict";var VRr=fw&&fw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WRr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JRr=fw&&fw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VRr(e,t,r);return WRr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.ParseInfo=void 0;var Owe=JRr($());fw.ParseInfo=Owe.serialization.object({separator:Owe.serialization.string().optional(),delimiter:Owe.serialization.string().optional()})});var pmt=b(pw=>{"use strict";var GRr=pw&&pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KRr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRr=pw&&pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GRr(e,t,r);return KRr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.RerankerDataMetrics=void 0;var Tp=YRr($());pw.RerankerDataMetrics=Tp.serialization.object({numTrainQueries:Tp.serialization.property("num_train_queries",Tp.serialization.number().optional()),numTrainRelevantPassages:Tp.serialization.property("num_train_relevant_passages",Tp.serialization.number().optional()),numTrainHardNegatives:Tp.serialization.property("num_train_hard_negatives",Tp.serialization.number().optional()),numEvalQueries:Tp.serialization.property("num_eval_queries",Tp.serialization.number().optional()),numEvalRelevantPassages:Tp.serialization.property("num_eval_relevant_passages",Tp.serialization.number().optional()),numEvalHardNegatives:Tp.serialization.property("num_eval_hard_negatives",Tp.serialization.number().optional())})});var hmt=b(hw=>{"use strict";var XRr=hw&&hw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZRr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QRr=hw&&hw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XRr(e,t,r);return ZRr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.ChatDataMetrics=void 0;var HF=QRr($());hw.ChatDataMetrics=HF.serialization.object({numTrainTurns:HF.serialization.property("num_train_turns",HF.serialization.number().optional()),numEvalTurns:HF.serialization.property("num_eval_turns",HF.serialization.number().optional()),preamble:HF.serialization.string().optional()})});var Ewe=b(mw=>{"use strict";var eIr=mw&&mw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tIr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rIr=mw&&mw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eIr(e,t,r);return tIr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.LabelMetric=void 0;var VF=rIr($());mw.LabelMetric=VF.serialization.object({totalExamples:VF.serialization.property("total_examples",VF.serialization.number().optional()),label:VF.serialization.string().optional(),samples:VF.serialization.list(VF.serialization.string()).optional()})});var mmt=b(gw=>{"use strict";var nIr=gw&&gw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oIr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iIr=gw&&gw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nIr(e,t,r);return oIr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.ClassifyDataMetrics=void 0;var Pwe=iIr($()),aIr=Ewe();gw.ClassifyDataMetrics=Pwe.serialization.object({labelMetrics:Pwe.serialization.property("label_metrics",Pwe.serialization.list(aIr.LabelMetric).optional())})});var Twe=b(yw=>{"use strict";var sIr=yw&&yw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uIr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lIr=yw&&yw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sIr(e,t,r);return uIr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.FinetuneDatasetMetrics=void 0;var Mp=lIr($());yw.FinetuneDatasetMetrics=Mp.serialization.object({trainableTokenCount:Mp.serialization.property("trainable_token_count",Mp.serialization.number().optional()),totalExamples:Mp.serialization.property("total_examples",Mp.serialization.number().optional()),trainExamples:Mp.serialization.property("train_examples",Mp.serialization.number().optional()),trainSizeBytes:Mp.serialization.property("train_size_bytes",Mp.serialization.number().optional()),evalExamples:Mp.serialization.property("eval_examples",Mp.serialization.number().optional()),evalSizeBytes:Mp.serialization.property("eval_size_bytes",Mp.serialization.number().optional())})});var Awe=b(bw=>{"use strict";var cIr=bw&&bw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dIr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fIr=bw&&bw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cIr(e,t,r);return dIr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.MetricsEmbedDataFieldsItem=void 0;var Mwe=fIr($());bw.MetricsEmbedDataFieldsItem=Mwe.serialization.object({name:Mwe.serialization.string().optional(),count:Mwe.serialization.number().optional()})});var Rwe=b(_w=>{"use strict";var pIr=_w&&_w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hIr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mIr=_w&&_w.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pIr(e,t,r);return hIr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.MetricsEmbedData=void 0;var gmt=mIr($()),gIr=Awe();_w.MetricsEmbedData=gmt.serialization.object({fields:gmt.serialization.list(gIr.MetricsEmbedDataFieldsItem).optional()})});var ymt=b(vw=>{"use strict";var yIr=vw&&vw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bIr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ir=vw&&vw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yIr(e,t,r);return bIr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.Metrics=void 0;var Iwe=_Ir($()),vIr=Twe(),wIr=Rwe();vw.Metrics=Iwe.serialization.object({finetuneDatasetMetrics:Iwe.serialization.property("finetune_dataset_metrics",vIr.FinetuneDatasetMetrics.optional()),embedData:Iwe.serialization.property("embed_data",wIr.MetricsEmbedData.optional())})});var Dwe=b(Sw=>{"use strict";var SIr=Sw&&Sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xIr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CIr=Sw&&Sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SIr(e,t,r);return xIr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.ConnectorOAuth=void 0;var ww=CIr($());Sw.ConnectorOAuth=ww.serialization.object({clientId:ww.serialization.property("client_id",ww.serialization.string().optional()),clientSecret:ww.serialization.property("client_secret",ww.serialization.string().optional()),authorizeUrl:ww.serialization.property("authorize_url",ww.serialization.string()),tokenUrl:ww.serialization.property("token_url",ww.serialization.string()),scope:ww.serialization.string().optional()})});var jwe=b(xw=>{"use strict";var OIr=xw&&xw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EIr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PIr=xw&&xw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OIr(e,t,r);return EIr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.ConnectorAuthStatus=void 0;var TIr=PIr($());xw.ConnectorAuthStatus=TIr.serialization.enum_(["valid","expired"])});var WF=b(Cw=>{"use strict";var MIr=Cw&&Cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AIr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RIr=Cw&&Cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MIr(e,t,r);return AIr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.Connector=void 0;var rl=RIr($()),IIr=Dwe(),DIr=jwe();Cw.Connector=rl.serialization.object({id:rl.serialization.string(),organizationId:rl.serialization.property("organization_id",rl.serialization.string().optional()),name:rl.serialization.string(),description:rl.serialization.string().optional(),url:rl.serialization.string().optional(),createdAt:rl.serialization.property("created_at",rl.serialization.date()),updatedAt:rl.serialization.property("updated_at",rl.serialization.date()),excludes:rl.serialization.list(rl.serialization.string()).optional(),authType:rl.serialization.property("auth_type",rl.serialization.string().optional()),oauth:IIr.ConnectorOAuth.optional(),authStatus:rl.serialization.property("auth_status",DIr.ConnectorAuthStatus.optional()),active:rl.serialization.boolean().optional(),continueOnFailure:rl.serialization.property("continue_on_failure",rl.serialization.boolean().optional())})});var bmt=b(Ow=>{"use strict";var jIr=Ow&&Ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NIr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LIr=Ow&&Ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jIr(e,t,r);return NIr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.ListConnectorsResponse=void 0;var VX=LIr($()),FIr=WF();Ow.ListConnectorsResponse=VX.serialization.object({connectors:VX.serialization.list(FIr.Connector),totalCount:VX.serialization.property("total_count",VX.serialization.number().optional())})});var _mt=b(Ew=>{"use strict";var kIr=Ew&&Ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BIr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ir=Ew&&Ew.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kIr(e,t,r);return BIr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.CreateConnectorResponse=void 0;var qIr=$Ir($()),UIr=WF();Ew.CreateConnectorResponse=qIr.serialization.object({connector:UIr.Connector})});var vmt=b(Pw=>{"use strict";var zIr=Pw&&Pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HIr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VIr=Pw&&Pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zIr(e,t,r);return HIr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.GetConnectorResponse=void 0;var WIr=VIr($()),JIr=WF();Pw.GetConnectorResponse=WIr.serialization.object({connector:JIr.Connector})});var wmt=b(Tw=>{"use strict";var GIr=Tw&&Tw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KIr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YIr=Tw&&Tw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GIr(e,t,r);return KIr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.DeleteConnectorResponse=void 0;var Nwe=YIr($());Tw.DeleteConnectorResponse=Nwe.serialization.record(Nwe.serialization.string(),Nwe.serialization.unknown())});var Smt=b(Mw=>{"use strict";var XIr=Mw&&Mw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZIr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QIr=Mw&&Mw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XIr(e,t,r);return ZIr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.UpdateConnectorResponse=void 0;var e1r=QIr($()),t1r=WF();Mw.UpdateConnectorResponse=e1r.serialization.object({connector:t1r.Connector})});var xmt=b(Aw=>{"use strict";var r1r=Aw&&Aw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n1r=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o1r=Aw&&Aw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r1r(e,t,r);return n1r(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.OAuthAuthorizeResponse=void 0;var Lwe=o1r($());Aw.OAuthAuthorizeResponse=Lwe.serialization.object({redirectUrl:Lwe.serialization.property("redirect_url",Lwe.serialization.string().optional())})});var Fwe=b(Rw=>{"use strict";var i1r=Rw&&Rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a1r=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s1r=Rw&&Rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i1r(e,t,r);return a1r(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.CompatibleEndpoint=void 0;var u1r=s1r($());Rw.CompatibleEndpoint=u1r.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var kwe=b(Dw=>{"use strict";var l1r=Dw&&Dw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),c1r=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d1r=Dw&&Dw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&l1r(e,t,r);return c1r(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.GetModelResponse=void 0;var Iw=d1r($()),Cmt=Fwe();Dw.GetModelResponse=Iw.serialization.object({name:Iw.serialization.string().optional(),endpoints:Iw.serialization.list(Cmt.CompatibleEndpoint).optional(),finetuned:Iw.serialization.boolean().optional(),contextLength:Iw.serialization.property("context_length",Iw.serialization.number().optional()),tokenizerUrl:Iw.serialization.property("tokenizer_url",Iw.serialization.string().optional()),defaultEndpoints:Iw.serialization.property("default_endpoints",Iw.serialization.list(Cmt.CompatibleEndpoint).optional())})});var Omt=b(jw=>{"use strict";var f1r=jw&&jw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p1r=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h1r=jw&&jw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f1r(e,t,r);return p1r(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.ListModelsResponse=void 0;var WX=h1r($()),m1r=kwe();jw.ListModelsResponse=WX.serialization.object({models:WX.serialization.list(m1r.GetModelResponse),nextPageToken:WX.serialization.property("next_page_token",WX.serialization.string().optional())})});var Emt=b(ie=>{"use strict";var g1r=ie&&ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pe=ie&&ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&g1r(e,t,r)};Object.defineProperty(ie,"__esModule",{value:!0});pe(f0e(),ie);pe(p0e(),ie);pe(Mht(),ie);pe(h0e(),ie);pe(Rht(),ie);pe(Dht(),ie);pe(Nht(),ie);pe(Fht(),ie);pe(Bht(),ie);pe(m0e(),ie);pe(g0e(),ie);pe(qht(),ie);pe(y0e(),ie);pe(b0e(),ie);pe(_0e(),ie);pe(v0e(),ie);pe(w0e(),ie);pe(S0e(),ie);pe(zht(),ie);pe(R0e(),ie);pe(I0e(),ie);pe(D0e(),ie);pe(Wht(),ie);pe(N0e(),ie);pe(L0e(),ie);pe(F0e(),ie);pe(k0e(),ie);pe(Ght(),ie);pe($0e(),ie);pe(q0e(),ie);pe(U0e(),ie);pe(Kht(),ie);pe(Yht(),ie);pe(Zht(),ie);pe(Qht(),ie);pe($F(),ie);pe(H0e(),ie);pe(V4(),ie);pe(W0e(),ie);pe(W4(),ie);pe(IX(),ie);pe(CI(),ie);pe(G0e(),ie);pe(jX(),ie);pe(bX(),ie);pe(K0e(),ie);pe(LX(),ie);pe(FX(),ie);pe(J4(),ie);pe(Y0e(),ie);pe(BX(),ie);pe(UF(),ie);pe(x0e(),ie);pe(C0e(),ie);pe(O0e(),ie);pe(Pp(),ie);pe(X0e(),ie);pe(k0(),ie);pe(Q0e(),ie);pe(twe(),ie);pe(rwe(),ie);pe(nwe(),ie);pe(owe(),ie);pe(iwe(),ie);pe(awe(),ie);pe(swe(),ie);pe(uwe(),ie);pe(lwe(),ie);pe(amt(),ie);pe(zve(),ie);pe(_X(),ie);pe(kve(),ie);pe(Bve(),ie);pe($ve(),ie);pe(qve(),ie);pe(dwe(),ie);pe(fwe(),ie);pe(smt(),ie);pe(K4(),ie);pe(pwe(),ie);pe(hwe(),ie);pe(mwe(),ie);pe(gwe(),ie);pe(ywe(),ie);pe(lmt(),ie);pe(vX(),ie);pe(wX(),ie);pe(E0e(),ie);pe(P0e(),ie);pe(T0e(),ie);pe(bwe(),ie);pe(_we(),ie);pe(vwe(),ie);pe(cmt(),ie);pe(dmt(),ie);pe(A0e(),ie);pe(Cwe(),ie);pe(Kve(),ie);pe(Gve(),ie);pe(Yve(),ie);pe(fmt(),ie);pe(pmt(),ie);pe(hmt(),ie);pe(Ewe(),ie);pe(mmt(),ie);pe(Twe(),ie);pe(Awe(),ie);pe(Rwe(),ie);pe(ymt(),ie);pe(xX(),ie);pe(Dwe(),ie);pe(jwe(),ie);pe(WF(),ie);pe(bmt(),ie);pe(PX(),ie);pe(c0e(),ie);pe(TX(),ie);pe(_mt(),ie);pe(vmt(),ie);pe(wmt(),ie);pe(Smt(),ie);pe(xmt(),ie);pe(Fwe(),ie);pe(kwe(),ie);pe(Omt(),ie)});var Pmt=b(Nw=>{"use strict";var y1r=Nw&&Nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b1r=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_1r=Nw&&Nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y1r(e,t,r);return b1r(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.ChatStreamRequest=void 0;var Fr=_1r($()),v1r=W4(),w1r=f0e(),S1r=IX(),x1r=CI(),C1r=p0e(),O1r=jX(),E1r=V4(),P1r=LX(),T1r=h0e();Nw.ChatStreamRequest=Fr.serialization.object({message:Fr.serialization.string(),model:Fr.serialization.string().optional(),preamble:Fr.serialization.string().optional(),chatHistory:Fr.serialization.property("chat_history",Fr.serialization.list(v1r.Message).optional()),conversationId:Fr.serialization.property("conversation_id",Fr.serialization.string().optional()),promptTruncation:Fr.serialization.property("prompt_truncation",w1r.ChatStreamRequestPromptTruncation.optional()),connectors:Fr.serialization.list(S1r.ChatConnector).optional(),searchQueriesOnly:Fr.serialization.property("search_queries_only",Fr.serialization.boolean().optional()),documents:Fr.serialization.list(x1r.ChatDocument).optional(),citationQuality:Fr.serialization.property("citation_quality",C1r.ChatStreamRequestCitationQuality.optional()),temperature:Fr.serialization.number().optional(),maxTokens:Fr.serialization.property("max_tokens",Fr.serialization.number().optional()),maxInputTokens:Fr.serialization.property("max_input_tokens",Fr.serialization.number().optional()),k:Fr.serialization.number().optional(),p:Fr.serialization.number().optional(),seed:Fr.serialization.number().optional(),stopSequences:Fr.serialization.property("stop_sequences",Fr.serialization.list(Fr.serialization.string()).optional()),frequencyPenalty:Fr.serialization.property("frequency_penalty",Fr.serialization.number().optional()),presencePenalty:Fr.serialization.property("presence_penalty",Fr.serialization.number().optional()),rawPrompting:Fr.serialization.property("raw_prompting",Fr.serialization.boolean().optional()),returnPrompt:Fr.serialization.property("return_prompt",Fr.serialization.boolean().optional()),tools:Fr.serialization.list(O1r.Tool).optional(),toolResults:Fr.serialization.property("tool_results",Fr.serialization.list(E1r.ToolResult).optional()),forceSingleStep:Fr.serialization.property("force_single_step",Fr.serialization.boolean().optional()),responseFormat:Fr.serialization.property("response_format",P1r.ResponseFormat.optional()),safetyMode:Fr.serialization.property("safety_mode",T1r.ChatStreamRequestSafetyMode.optional())})});var Tmt=b(Lw=>{"use strict";var M1r=Lw&&Lw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A1r=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R1r=Lw&&Lw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M1r(e,t,r);return A1r(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.ChatRequest=void 0;var kr=R1r($()),I1r=W4(),D1r=m0e(),j1r=IX(),N1r=CI(),L1r=g0e(),F1r=jX(),k1r=V4(),B1r=LX(),$1r=y0e();Lw.ChatRequest=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(I1r.Message).optional()),conversationId:kr.serialization.property("conversation_id",kr.serialization.string().optional()),promptTruncation:kr.serialization.property("prompt_truncation",D1r.ChatRequestPromptTruncation.optional()),connectors:kr.serialization.list(j1r.ChatConnector).optional(),searchQueriesOnly:kr.serialization.property("search_queries_only",kr.serialization.boolean().optional()),documents:kr.serialization.list(N1r.ChatDocument).optional(),citationQuality:kr.serialization.property("citation_quality",L1r.ChatRequestCitationQuality.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(F1r.Tool).optional(),toolResults:kr.serialization.property("tool_results",kr.serialization.list(k1r.ToolResult).optional()),forceSingleStep:kr.serialization.property("force_single_step",kr.serialization.boolean().optional()),responseFormat:kr.serialization.property("response_format",B1r.ResponseFormat.optional()),safetyMode:kr.serialization.property("safety_mode",$1r.ChatRequestSafetyMode.optional())})});var Mmt=b(Fw=>{"use strict";var q1r=Fw&&Fw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U1r=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z1r=Fw&&Fw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q1r(e,t,r);return U1r(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.GenerateStreamRequest=void 0;var Oi=z1r($()),H1r=b0e(),V1r=_0e();Fw.GenerateStreamRequest=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:H1r.GenerateStreamRequestTruncate.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",V1r.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Oi.serialization.property("raw_prompting",Oi.serialization.boolean().optional())})});var Amt=b(kw=>{"use strict";var W1r=kw&&kw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J1r=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G1r=kw&&kw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W1r(e,t,r);return J1r(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.GenerateRequest=void 0;var Ei=G1r($()),K1r=v0e(),Y1r=w0e();kw.GenerateRequest=Ei.serialization.object({prompt:Ei.serialization.string(),model:Ei.serialization.string().optional(),numGenerations:Ei.serialization.property("num_generations",Ei.serialization.number().optional()),maxTokens:Ei.serialization.property("max_tokens",Ei.serialization.number().optional()),truncate:K1r.GenerateRequestTruncate.optional(),temperature:Ei.serialization.number().optional(),seed:Ei.serialization.number().optional(),preset:Ei.serialization.string().optional(),endSequences:Ei.serialization.property("end_sequences",Ei.serialization.list(Ei.serialization.string()).optional()),stopSequences:Ei.serialization.property("stop_sequences",Ei.serialization.list(Ei.serialization.string()).optional()),k:Ei.serialization.number().optional(),p:Ei.serialization.number().optional(),frequencyPenalty:Ei.serialization.property("frequency_penalty",Ei.serialization.number().optional()),presencePenalty:Ei.serialization.property("presence_penalty",Ei.serialization.number().optional()),returnLikelihoods:Ei.serialization.property("return_likelihoods",Y1r.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Ei.serialization.property("raw_prompting",Ei.serialization.boolean().optional())})});var Rmt=b(Bw=>{"use strict";var X1r=Bw&&Bw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z1r=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q1r=Bw&&Bw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X1r(e,t,r);return Z1r(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.EmbedRequest=void 0;var FI=Q1r($()),eDr=vX(),tDr=wX(),rDr=S0e();Bw.EmbedRequest=FI.serialization.object({texts:FI.serialization.list(FI.serialization.string()),model:FI.serialization.string().optional(),inputType:FI.serialization.property("input_type",eDr.EmbedInputType.optional()),embeddingTypes:FI.serialization.property("embedding_types",FI.serialization.list(tDr.EmbeddingType).optional()),truncate:rDr.EmbedRequestTruncate.optional()})});var Imt=b($w=>{"use strict";var nDr=$w&&$w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oDr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iDr=$w&&$w.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nDr(e,t,r);return oDr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.RerankRequest=void 0;var Ap=iDr($()),aDr=R0e();$w.RerankRequest=Ap.serialization.object({model:Ap.serialization.string().optional(),query:Ap.serialization.string(),documents:Ap.serialization.list(aDr.RerankRequestDocumentsItem),topN:Ap.serialization.property("top_n",Ap.serialization.number().optional()),rankFields:Ap.serialization.property("rank_fields",Ap.serialization.list(Ap.serialization.string()).optional()),returnDocuments:Ap.serialization.property("return_documents",Ap.serialization.boolean().optional()),maxChunksPerDoc:Ap.serialization.property("max_chunks_per_doc",Ap.serialization.number().optional())})});var Dmt=b(qw=>{"use strict";var sDr=qw&&qw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uDr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lDr=qw&&qw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sDr(e,t,r);return uDr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ClassifyRequest=void 0;var JF=lDr($()),cDr=Cwe(),dDr=N0e();qw.ClassifyRequest=JF.serialization.object({inputs:JF.serialization.list(JF.serialization.string()),examples:JF.serialization.list(cDr.ClassifyExample).optional(),model:JF.serialization.string().optional(),preset:JF.serialization.string().optional(),truncate:dDr.ClassifyRequestTruncate.optional()})});var jmt=b(Uw=>{"use strict";var fDr=Uw&&Uw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pDr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=Uw&&Uw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fDr(e,t,r);return pDr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.SummarizeRequest=void 0;var GF=hDr($()),mDr=$0e(),gDr=q0e(),yDr=U0e();Uw.SummarizeRequest=GF.serialization.object({text:GF.serialization.string(),length:mDr.SummarizeRequestLength.optional(),format:gDr.SummarizeRequestFormat.optional(),model:GF.serialization.string().optional(),extractiveness:yDr.SummarizeRequestExtractiveness.optional(),temperature:GF.serialization.number().optional(),additionalCommand:GF.serialization.property("additional_command",GF.serialization.string().optional())})});var Nmt=b(zw=>{"use strict";var bDr=zw&&zw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Dr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDr=zw&&zw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bDr(e,t,r);return _Dr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.TokenizeRequest=void 0;var Bwe=vDr($());zw.TokenizeRequest=Bwe.serialization.object({text:Bwe.serialization.string(),model:Bwe.serialization.string()})});var Lmt=b(Hw=>{"use strict";var wDr=Hw&&Hw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SDr=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xDr=Hw&&Hw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wDr(e,t,r);return SDr(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.DetokenizeRequest=void 0;var JX=xDr($());Hw.DetokenizeRequest=JX.serialization.object({tokens:JX.serialization.list(JX.serialization.number()),model:JX.serialization.string()})});var Fmt=b($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.DetokenizeRequest=$a.TokenizeRequest=$a.SummarizeRequest=$a.ClassifyRequest=$a.RerankRequest=$a.EmbedRequest=$a.GenerateRequest=$a.GenerateStreamRequest=$a.ChatRequest=$a.ChatStreamRequest=void 0;var CDr=Pmt();Object.defineProperty($a,"ChatStreamRequest",{enumerable:!0,get:function(){return CDr.ChatStreamRequest}});var ODr=Tmt();Object.defineProperty($a,"ChatRequest",{enumerable:!0,get:function(){return ODr.ChatRequest}});var EDr=Mmt();Object.defineProperty($a,"GenerateStreamRequest",{enumerable:!0,get:function(){return EDr.GenerateStreamRequest}});var PDr=Amt();Object.defineProperty($a,"GenerateRequest",{enumerable:!0,get:function(){return PDr.GenerateRequest}});var TDr=Rmt();Object.defineProperty($a,"EmbedRequest",{enumerable:!0,get:function(){return TDr.EmbedRequest}});var MDr=Imt();Object.defineProperty($a,"RerankRequest",{enumerable:!0,get:function(){return MDr.RerankRequest}});var ADr=Dmt();Object.defineProperty($a,"ClassifyRequest",{enumerable:!0,get:function(){return ADr.ClassifyRequest}});var RDr=jmt();Object.defineProperty($a,"SummarizeRequest",{enumerable:!0,get:function(){return RDr.SummarizeRequest}});var IDr=Nmt();Object.defineProperty($a,"TokenizeRequest",{enumerable:!0,get:function(){return IDr.TokenizeRequest}});var DDr=Lmt();Object.defineProperty($a,"DetokenizeRequest",{enumerable:!0,get:function(){return DDr.DetokenizeRequest}})});var kmt=b(kI=>{"use strict";var jDr=kI&&kI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NDr=kI&&kI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jDr(e,t,r)};Object.defineProperty(kI,"__esModule",{value:!0});NDr(Fmt(),kI)});var nC=b(rC=>{"use strict";var LDr=rC&&rC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$we=rC&&rC.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LDr(e,t,r)};Object.defineProperty(rC,"__esModule",{value:!0});$we(Pht(),rC);$we(Emt(),rC);$we(kmt(),rC)});var qwe=b(_o=>{"use strict";var FDr=_o&&_o.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kDr=_o&&_o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BDr=_o&&_o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FDr(e,t,r);return kDr(e,t),e},GX=_o&&_o.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},$Dr=_o&&_o.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(_o,"__esModule",{value:!0});_o.fetchOverride=_o.parseAWSEvent=_o.getEndpointFromUrl=_o.getAuthHeaders=_o.getUrl=_o.mapResponseFromBedrock=void 0;var qDr=Dfe(),UDr=(Art(),ml(Mrt)),zDr=Lot(),HDr=Xit(),VDr=r4(),WDr=$(),JDr=i_e(),GDr=mpt(),Z4=BDr(nC()),KDr=(t,e)=>GX(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),YDr={chat:Z4.StreamedChatResponse,generate:Z4.GenerateStreamedResponse},XDr={chat:Z4.NonStreamedChatResponse,embed:Z4.EmbedResponse,generate:Z4.Generation},ZDr=(t,e,r)=>GX(void 0,void 0,void 0,function*(){let n=t?YDr[e]:XDr[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});_o.mapResponseFromBedrock=ZDr;var QDr=(t,e,r,n)=>{let o={bedrock:n?"invoke-with-response-stream":"invoke",sagemaker:n?"invocations-response-stream":"invocations"}[t];return{bedrock:`https://${t}-runtime.${e}.amazonaws.com/model/${r}/${o}`,sagemaker:`https://runtime.sagemaker.${e}.amazonaws.com/endpoints/${r}/${o}`}[t]};_o.getUrl=QDr;var ejr=(t,e,r,n,o,i)=>GX(void 0,void 0,void 0,function*(){let a=(0,UDr.fromNodeProviderChain)(),s=yield KDr(()=>{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 HDr.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:qDr.Sha256});delete r.connection,r.host=t.hostname;let l=new zDr.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});_o.getAuthHeaders=ejr;var tjr=(t,e,r,n)=>{if(e&&t.includes(e))return"chat";if(r&&t.includes(r))return"embed";if(n&&t.includes(n))return"generate";throw new Error(`Unknown endpoint in url: ${t}`)};_o.getEndpointFromUrl=tjr;var rjr=t=>{let e=/{[^\}]*}/,r=t.match(e);if(r?.[0]){let n=JSON.parse(r[0]);if(n.bytes){let o=Buffer.from(n.bytes,"base64").toString("utf-8"),i=JSON.parse(o);if(i.event_type)return i}}};_o.parseAWSEvent=rjr;var njr=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>GX(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=Boolean(l.stream),d=(0,_o.getUrl)(t,e,l.model,c);delete l.stream,delete l.model,delete i.headers.Authorization,i.headers.Host=new URL(d).hostname;let f=yield(0,_o.getAuthHeaders)(new URL(d),i.method,i.headers,JSON.stringify(l),t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=d,i.headers=f;let p=yield(0,WDr.fetcher)(i);if(!p.ok)return p;try{if(c){let v=(0,JDr.readableStreamAsyncIterable)(p.body),g=new GDr.LineDecoder,_=new VDr.PassThrough;try{for(var h=$Dr(v),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);_.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);_.push(JSON.stringify(O)+`
`)}}return _.end(),{ok:!0,body:_}}else{let v=yield p.body;return{ok:!0,body:yield(0,_o.mapResponseFromBedrock)(c,u,v)}}}catch(v){throw v}});_o.fetchOverride=njr});var oC=b(KX=>{"use strict";Object.defineProperty(KX,"__esModule",{value:!0});KX.CohereEnvironment=void 0;KX.CohereEnvironment={Production:"https://api.cohere.com"}});var JP=b((Bmt,YX)=>{(function(t,e,r){typeof YX<"u"&&YX.exports?YX.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",Bmt,function(){function t(e){var r=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var i=e[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<e.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),r.push(i))}var a=r.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var s=a.split("?");return a=s.shift()+(s.length>0?"?":"")+s.join("&"),a}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),t(e)}})});var zwe=b(Af=>{"use strict";var ojr=Af&&Af.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ijr=Af&&Af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4=Af&&Af.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ojr(e,t,r);return ijr(e,t),e},XX=Af&&Af.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},ajr=Af&&Af.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Af,"__esModule",{value:!0});Af.V2=void 0;var $mt=Q4(oC()),Tf=Q4($()),qa=Q4(Ex()),Mf=Q4(nC()),qmt=ajr(JP()),iC=Q4(rs()),Uwe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return XX(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Tf.fetcher)({url:(0,qmt.default)((o=yield Tf.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$mt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tf.Supplier.get(this._options.clientName))!=null?yield Tf.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":Tf.RUNTIME.type,"X-Fern-Runtime-Version":Tf.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Mf.V2ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new Tf.Stream({stream:i.body,parse:a=>XX(this,void 0,void 0,function*(){return Mf.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 qa.BadRequestError(i.error.body);case 401:throw new qa.UnauthorizedError(i.error.body);case 403:throw new qa.ForbiddenError(i.error.body);case 404:throw new qa.NotFoundError(i.error.body);case 422:throw new qa.UnprocessableEntityError(Mf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qa.TooManyRequestsError(Mf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qa.ClientClosedRequestError(Mf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qa.InternalServerError(i.error.body);case 501:throw new qa.NotImplementedError(Mf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qa.ServiceUnavailableError(i.error.body);case 504:throw new qa.GatewayTimeoutError(Mf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new iC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new iC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new iC.CohereTimeoutError;case"unknown":throw new iC.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return XX(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Tf.fetcher)({url:(0,qmt.default)((o=yield Tf.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$mt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tf.Supplier.get(this._options.clientName))!=null?yield Tf.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":Tf.RUNTIME.type,"X-Fern-Runtime-Version":Tf.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Mf.V2ChatRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Mf.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 qa.BadRequestError(i.error.body);case 401:throw new qa.UnauthorizedError(i.error.body);case 403:throw new qa.ForbiddenError(i.error.body);case 404:throw new qa.NotFoundError(i.error.body);case 422:throw new qa.UnprocessableEntityError(Mf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qa.TooManyRequestsError(Mf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qa.ClientClosedRequestError(Mf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qa.InternalServerError(i.error.body);case 501:throw new qa.NotImplementedError(Mf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qa.ServiceUnavailableError(i.error.body);case 504:throw new qa.GatewayTimeoutError(Mf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new iC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new iC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new iC.CohereTimeoutError;case"unknown":throw new iC.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return XX(this,void 0,void 0,function*(){let r=(e=yield Tf.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new iC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Af.V2=Uwe});var Umt=b(Rf=>{"use strict";var sjr=Rf&&Rf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ujr=Rf&&Rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t3=Rf&&Rf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sjr(e,t,r);return ujr(e,t),e},e3=Rf&&Rf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},ljr=Rf&&Rf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rf,"__esModule",{value:!0});Rf.EmbedJobs=void 0;var ZX=t3(oC()),Pi=t3($()),ur=t3(Ex()),QX=ljr(JP()),Ji=t3(nC()),dc=t3(rs()),Hwe=class{constructor(e={}){this._options=e}list(e){var r,n;return e3(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Pi.fetcher)({url:(0,QX.default)((n=yield Pi.Supplier.get(this._options.environment))!==null&&n!==void 0?n:ZX.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Pi.Supplier.get(this._options.clientName))!=null?yield Pi.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":Pi.RUNTIME.type,"X-Fern-Runtime-Version":Pi.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Ji.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(Ji.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Ji.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Ji.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(Ji.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(Ji.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new dc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return e3(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Pi.fetcher)({url:(0,QX.default)((o=yield Pi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZX.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Pi.Supplier.get(this._options.clientName))!=null?yield Pi.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":Pi.RUNTIME.type,"X-Fern-Runtime-Version":Pi.RUNTIME.version},contentType:"application/json",requestType:"json",body:Ji.CreateEmbedJobRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Ji.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(Ji.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Ji.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Ji.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(Ji.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(Ji.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return e3(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Pi.fetcher)({url:(0,QX.default)((o=yield Pi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZX.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Pi.Supplier.get(this._options.clientName))!=null?yield Pi.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":Pi.RUNTIME.type,"X-Fern-Runtime-Version":Pi.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 Ji.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(Ji.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Ji.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Ji.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(Ji.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(Ji.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return e3(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Pi.fetcher)({url:(0,QX.default)((o=yield Pi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ZX.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Pi.Supplier.get(this._options.clientName))!=null?yield Pi.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":Pi.RUNTIME.type,"X-Fern-Runtime-Version":Pi.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(Ji.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ur.TooManyRequestsError(Ji.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ur.ClientClosedRequestError(Ji.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(Ji.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(Ji.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return e3(this,void 0,void 0,function*(){let r=(e=yield Pi.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new dc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Rf.EmbedJobs=Hwe});var zmt=b(If=>{"use strict";var cjr=If&&If.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),djr=If&&If.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o3=If&&If.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cjr(e,t,r);return djr(e,t),e},KF=If&&If.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},fjr=If&&If.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(If,"__esModule",{value:!0});If.Datasets=void 0;var r3=o3(oC()),Hn=o3($()),Rt=o3(Ex()),n3=fjr(JP()),Ro=o3(nC()),us=o3(rs()),Vwe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return KF(this,void 0,void 0,function*(){let{datasetType:i,before:a,after:s,limit:u,offset:l,validationStatus:c}=e,d={};i!=null&&(d.datasetType=i),a!=null&&(d.before=a.toISOString()),s!=null&&(d.after=s.toISOString()),u!=null&&(d.limit=u.toString()),l!=null&&(d.offset=l.toString()),c!=null&&(d.validationStatus=c);let f=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Hn.fetcher)({url:(0,n3.default)((o=yield Hn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r3.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Hn.Supplier.get(this._options.clientName))!=null?yield Hn.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":Hn.RUNTIME.type,"X-Fern-Runtime-Version":Hn.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 Ro.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(Ro.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Ro.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Ro.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(Ro.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(Ro.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new us.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new us.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new us.CohereTimeoutError;case"unknown":throw new us.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return KF(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 Hn.newFormData();yield u.appendFile("data",e,e?.name),r!=null&&(yield u.appendFile("eval_data",r,r?.name));let l=yield u.getRequest(),c=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Hn.fetcher)({url:(0,n3.default)((a=yield Hn.Supplier.get(this._options.environment))!==null&&a!==void 0?a:r3.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Hn.Supplier.get(this._options.clientName))!=null?yield Hn.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":Hn.RUNTIME.type,"X-Fern-Runtime-Version":Hn.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 Ro.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(Ro.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Ro.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Ro.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(Ro.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(Ro.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new us.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new us.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new us.CohereTimeoutError;case"unknown":throw new us.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return KF(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Hn.fetcher)({url:(0,n3.default)((n=yield Hn.Supplier.get(this._options.environment))!==null&&n!==void 0?n:r3.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Hn.Supplier.get(this._options.clientName))!=null?yield Hn.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":Hn.RUNTIME.type,"X-Fern-Runtime-Version":Hn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Ro.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(Ro.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Ro.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Ro.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(Ro.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(Ro.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new us.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new us.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new us.CohereTimeoutError;case"unknown":throw new us.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return KF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Hn.fetcher)({url:(0,n3.default)((o=yield Hn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r3.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Hn.Supplier.get(this._options.clientName))!=null?yield Hn.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":Hn.RUNTIME.type,"X-Fern-Runtime-Version":Hn.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 Ro.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(Ro.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Ro.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Ro.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(Ro.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(Ro.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new us.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new us.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new us.CohereTimeoutError;case"unknown":throw new us.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return KF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Hn.fetcher)({url:(0,n3.default)((o=yield Hn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:r3.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Hn.Supplier.get(this._options.clientName))!=null?yield Hn.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":Hn.RUNTIME.type,"X-Fern-Runtime-Version":Hn.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 Ro.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(Ro.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(Ro.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(Ro.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(Ro.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(Ro.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new us.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new us.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new us.CohereTimeoutError;case"unknown":throw new us.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return KF(this,void 0,void 0,function*(){let r=(e=yield Hn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new us.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};If.Datasets=Vwe});var Hmt=b(Df=>{"use strict";var pjr=Df&&Df.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hjr=Df&&Df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i3=Df&&Df.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pjr(e,t,r);return hjr(e,t),e},BI=Df&&Df.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},mjr=Df&&Df.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Df,"__esModule",{value:!0});Df.Connectors=void 0;var YF=i3(oC()),Qr=i3($()),at=i3(Ex()),XF=mjr(JP()),Wr=i3(nC()),Ti=i3(rs()),Wwe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return BI(this,void 0,void 0,function*(){let{limit:i,offset:a}=e,s={};i!=null&&(s.limit=i.toString()),a!=null&&(s.offset=a.toString());let u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qr.fetcher)({url:(0,XF.default)((o=yield Qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:YF.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return Wr.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 at.BadRequestError(u.error.body);case 401:throw new at.UnauthorizedError(u.error.body);case 403:throw new at.ForbiddenError(u.error.body);case 404:throw new at.NotFoundError(u.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(u.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(u.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Ti.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return BI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qr.fetcher)({url:(0,XF.default)((o=yield Qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:YF.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:Wr.CreateConnectorRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Wr.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 at.BadRequestError(i.error.body);case 401:throw new at.UnauthorizedError(i.error.body);case 403:throw new at.ForbiddenError(i.error.body);case 404:throw new at.NotFoundError(i.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(i.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(i.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return BI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qr.fetcher)({url:(0,XF.default)((o=yield Qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:YF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Wr.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 at.BadRequestError(i.error.body);case 401:throw new at.UnauthorizedError(i.error.body);case 403:throw new at.ForbiddenError(i.error.body);case 404:throw new at.NotFoundError(i.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(i.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(i.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return BI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qr.fetcher)({url:(0,XF.default)((o=yield Qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:YF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Wr.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 at.BadRequestError(i.error.body);case 401:throw new at.UnauthorizedError(i.error.body);case 403:throw new at.ForbiddenError(i.error.body);case 404:throw new at.NotFoundError(i.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(i.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(i.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ti.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return BI(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Qr.fetcher)({url:(0,XF.default)((i=yield Qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:YF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:Wr.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 Wr.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 at.BadRequestError(a.error.body);case 401:throw new at.UnauthorizedError(a.error.body);case 403:throw new at.ForbiddenError(a.error.body);case 404:throw new at.NotFoundError(a.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(a.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(a.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Ti.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return BI(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:Qr.fetcher)({url:(0,XF.default)((i=yield Qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:YF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qr.Supplier.get(this._options.clientName))!=null?yield Qr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Qr.RUNTIME.type,"X-Fern-Runtime-Version":Qr.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(u.ok)return Wr.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 at.BadRequestError(u.error.body);case 401:throw new at.UnauthorizedError(u.error.body);case 403:throw new at.ForbiddenError(u.error.body);case 404:throw new at.NotFoundError(u.error.body);case 422:throw new at.UnprocessableEntityError(Wr.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new at.TooManyRequestsError(Wr.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new at.ClientClosedRequestError(Wr.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new at.InternalServerError(u.error.body);case 501:throw new at.NotImplementedError(Wr.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new at.ServiceUnavailableError(u.error.body);case 504:throw new at.GatewayTimeoutError(Wr.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ti.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Ti.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Ti.CohereTimeoutError;case"unknown":throw new Ti.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return BI(this,void 0,void 0,function*(){let r=(e=yield Qr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ti.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Df.Connectors=Wwe});var Jmt=b(jf=>{"use strict";var gjr=jf&&jf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yjr=jf&&jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a3=jf&&jf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gjr(e,t,r);return yjr(e,t),e},Jwe=jf&&jf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},bjr=jf&&jf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jf,"__esModule",{value:!0});jf.Models=void 0;var Vmt=a3(oC()),Rp=a3($()),Ua=a3(Ex()),Wmt=bjr(JP()),Hh=a3(nC()),aC=a3(rs()),Gwe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return Jwe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Rp.fetcher)({url:(0,Wmt.default)((o=yield Rp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Vmt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Rp.Supplier.get(this._options.clientName))!=null?yield Rp.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":Rp.RUNTIME.type,"X-Fern-Runtime-Version":Rp.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 Hh.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 Ua.BadRequestError(i.error.body);case 401:throw new Ua.UnauthorizedError(i.error.body);case 403:throw new Ua.ForbiddenError(i.error.body);case 404:throw new Ua.NotFoundError(i.error.body);case 422:throw new Ua.UnprocessableEntityError(Hh.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ua.TooManyRequestsError(Hh.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ua.ClientClosedRequestError(Hh.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ua.InternalServerError(i.error.body);case 501:throw new Ua.NotImplementedError(Hh.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ua.ServiceUnavailableError(i.error.body);case 504:throw new Ua.GatewayTimeoutError(Hh.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new aC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new aC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new aC.CohereTimeoutError;case"unknown":throw new aC.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return Jwe(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,endpoint:s,defaultOnly:u}=e,l={};i!=null&&(l.page_size=i.toString()),a!=null&&(l.page_token=a),s!=null&&(l.endpoint=s),u!=null&&(l.default_only=u.toString());let c=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Rp.fetcher)({url:(0,Wmt.default)((o=yield Rp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Vmt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Rp.Supplier.get(this._options.clientName))!=null?yield Rp.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":Rp.RUNTIME.type,"X-Fern-Runtime-Version":Rp.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 Hh.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 Ua.BadRequestError(c.error.body);case 401:throw new Ua.UnauthorizedError(c.error.body);case 403:throw new Ua.ForbiddenError(c.error.body);case 404:throw new Ua.NotFoundError(c.error.body);case 422:throw new Ua.UnprocessableEntityError(Hh.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ua.TooManyRequestsError(Hh.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ua.ClientClosedRequestError(Hh.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ua.InternalServerError(c.error.body);case 501:throw new Ua.NotImplementedError(Hh.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ua.ServiceUnavailableError(c.error.body);case 504:throw new Ua.GatewayTimeoutError(Hh.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new aC.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new aC.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new aC.CohereTimeoutError;case"unknown":throw new aC.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Jwe(this,void 0,void 0,function*(){let r=(e=yield Rp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new aC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};jf.Models=Gwe});var Gmt=b(Nf=>{"use strict";var _jr=Nf&&Nf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vjr=Nf&&Nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s3=Nf&&Nf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_jr(e,t,r);return vjr(e,t),e},GP=Nf&&Nf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},wjr=Nf&&Nf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nf,"__esModule",{value:!0});Nf.Finetuning=void 0;var $I=s3(oC()),mr=s3($()),wr=s3(Ex()),qI=wjr(JP()),sC=s3(nC()),Bo=s3(rs()),Kwe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return GP(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,orderBy:s}=e,u={};i!=null&&(u.page_size=i.toString()),a!=null&&(u.page_token=a),s!=null&&(u.order_by=s);let l=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mr.fetcher)({url:(0,qI.default)((o=yield mr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$I.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.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 sC.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 wr.BadRequestError(l.error.body);case 401:throw new wr.UnauthorizedError(l.error.body);case 403:throw new wr.ForbiddenError(l.error.body);case 404:throw new wr.NotFoundError(l.error.body);case 500:throw new wr.InternalServerError(l.error.body);case 503:throw new wr.ServiceUnavailableError(l.error.body);default:throw new Bo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Bo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return GP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mr.fetcher)({url:(0,qI.default)((o=yield mr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$I.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.RUNTIME.version},contentType:"application/json",requestType:"json",body:sC.finetuning.FinetunedModel.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return sC.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 wr.BadRequestError(i.error.body);case 401:throw new wr.UnauthorizedError(i.error.body);case 403:throw new wr.ForbiddenError(i.error.body);case 404:throw new wr.NotFoundError(i.error.body);case 500:throw new wr.InternalServerError(i.error.body);case 503:throw new wr.ServiceUnavailableError(i.error.body);default:throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return GP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mr.fetcher)({url:(0,qI.default)((o=yield mr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$I.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.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 sC.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 wr.BadRequestError(i.error.body);case 401:throw new wr.UnauthorizedError(i.error.body);case 403:throw new wr.ForbiddenError(i.error.body);case 404:throw new wr.NotFoundError(i.error.body);case 500:throw new wr.InternalServerError(i.error.body);case 503:throw new wr.ServiceUnavailableError(i.error.body);default:throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return GP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mr.fetcher)({url:(0,qI.default)((o=yield mr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:$I.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.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 sC.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 wr.BadRequestError(i.error.body);case 401:throw new wr.UnauthorizedError(i.error.body);case 403:throw new wr.ForbiddenError(i.error.body);case 404:throw new wr.NotFoundError(i.error.body);case 500:throw new wr.InternalServerError(i.error.body);case 503:throw new wr.ServiceUnavailableError(i.error.body);default:throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Bo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,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:mr.fetcher)({url:(0,qI.default)((i=yield mr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:$I.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.RUNTIME.version},contentType:"application/json",requestType:"json",body:sC.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 sC.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 wr.BadRequestError(a.error.body);case 401:throw new wr.UnauthorizedError(a.error.body);case 403:throw new wr.ForbiddenError(a.error.body);case 404:throw new wr.NotFoundError(a.error.body);case 500:throw new wr.InternalServerError(a.error.body);case 503:throw new wr.ServiceUnavailableError(a.error.body);default:throw new Bo.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Bo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:a.error.errorMessage})}})}listEvents(e,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:mr.fetcher)({url:(0,qI.default)((i=yield mr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:$I.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.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 sC.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 wr.BadRequestError(c.error.body);case 401:throw new wr.UnauthorizedError(c.error.body);case 403:throw new wr.ForbiddenError(c.error.body);case 404:throw new wr.NotFoundError(c.error.body);case 500:throw new wr.InternalServerError(c.error.body);case 503:throw new wr.ServiceUnavailableError(c.error.body);default:throw new Bo.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Bo.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,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:mr.fetcher)({url:(0,qI.default)((i=yield mr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:$I.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mr.Supplier.get(this._options.clientName))!=null?yield mr.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":mr.RUNTIME.type,"X-Fern-Runtime-Version":mr.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 sC.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 wr.BadRequestError(l.error.body);case 401:throw new wr.UnauthorizedError(l.error.body);case 403:throw new wr.ForbiddenError(l.error.body);case 404:throw new wr.NotFoundError(l.error.body);case 500:throw new wr.InternalServerError(l.error.body);case 503:throw new wr.ServiceUnavailableError(l.error.body);default:throw new Bo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Bo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Bo.CohereTimeoutError;case"unknown":throw new Bo.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return GP(this,void 0,void 0,function*(){let r=(e=yield mr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Bo.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Nf.Finetuning=Kwe});var eZ=b(Ff=>{"use strict";var Sjr=Ff&&Ff.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xjr=Ff&&Ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u3=Ff&&Ff.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sjr(e,t,r);return xjr(e,t),e},Lf=Ff&&Ff.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Cjr=Ff&&Ff.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ff,"__esModule",{value:!0});Ff.CohereClient=void 0;var Tg=u3(oC()),et=u3($()),he=u3(Ex()),ze=u3(nC()),Mg=Cjr(JP()),ar=u3(rs()),Ojr=zwe(),Ejr=Umt(),Pjr=zmt(),Tjr=Hmt(),Mjr=Jmt(),Ajr=Gmt(),Ywe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new et.Stream({stream:i.body,parse:a=>Lf(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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new et.Stream({stream:i.body,parse:a=>Lf(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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Lf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:et.fetcher)({url:(0,Mg.default)((o=yield et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Tg.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(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return 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 ar.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ar.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Lf(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:et.fetcher)({url:(0,Mg.default)((n=yield et.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Tg.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:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.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 ar.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new ar.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new ar.CohereTimeoutError;case"unknown":throw new ar.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new Ojr.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new Ejr.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new Pjr.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new Tjr.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new Mjr.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new Ajr.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Lf(this,void 0,void 0,function*(){let r=(e=yield et.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new ar.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Ff.CohereClient=Ywe});var Zwe=b(tZ=>{"use strict";Object.defineProperty(tZ,"__esModule",{value:!0});tZ.AwsClient=void 0;var Rjr=eZ(),Xwe=class extends Rjr.CohereClient{constructor(e){e.token="n/a",super(e)}};tZ.AwsClient=Xwe});var Kmt=b(rZ=>{"use strict";Object.defineProperty(rZ,"__esModule",{value:!0});rZ.BedrockClient=void 0;var Ijr=qwe(),Djr=Zwe(),Qwe=class extends Djr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Ijr.fetchOverride)("bedrock",e)}))}};rZ.BedrockClient=Qwe});var Ymt=b(nZ=>{"use strict";Object.defineProperty(nZ,"__esModule",{value:!0});nZ.CohereClientV2=void 0;var jjr=zwe(),Njr=eZ(),eSe=class{constructor(e){this._options=e,this.client=new Njr.CohereClient(this._options),this.clientV2=new jjr.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}};nZ.CohereClientV2=eSe});var Xmt=b(oZ=>{"use strict";Object.defineProperty(oZ,"__esModule",{value:!0});oZ.CustomClient=void 0;var Ljr=eZ(),tSe=class extends Ljr.CohereClient{constructor(e={}){var r,n;try{let o=/\/v1\/?$/,i=(r=e.environment)===null||r===void 0?void 0:r.toString().replace(o,"");i!==((n=e.environment)===null||n===void 0?void 0:n.toString())&&(e.environment=i)}catch{}super(e),this._options=e}};oZ.CustomClient=tSe});var Zmt=b(iZ=>{"use strict";Object.defineProperty(iZ,"__esModule",{value:!0});iZ.SagemakerClient=void 0;var Fjr=Zwe(),kjr=qwe(),rSe=class extends Fjr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,kjr.fetchOverride)("sagemaker",e)}))}};iZ.SagemakerClient=rSe});var l3=b(Gi=>{"use strict";var Bjr=Gi&&Gi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$jr=Gi&&Gi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qjr=Gi&&Gi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bjr(e,t,r);return $jr(e,t),e};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.SagemakerClient=Gi.CohereTimeoutError=Gi.CohereError=Gi.CohereEnvironment=Gi.CohereClient=Gi.CohereClientV2=Gi.BedrockClient=Gi.Cohere=void 0;Gi.Cohere=qjr(Ex());var Ujr=Kmt();Object.defineProperty(Gi,"BedrockClient",{enumerable:!0,get:function(){return Ujr.BedrockClient}});var zjr=Ymt();Object.defineProperty(Gi,"CohereClientV2",{enumerable:!0,get:function(){return zjr.CohereClientV2}});var Hjr=Xmt();Object.defineProperty(Gi,"CohereClient",{enumerable:!0,get:function(){return Hjr.CustomClient}});var Vjr=oC();Object.defineProperty(Gi,"CohereEnvironment",{enumerable:!0,get:function(){return Vjr.CohereEnvironment}});var Qmt=rs();Object.defineProperty(Gi,"CohereError",{enumerable:!0,get:function(){return Qmt.CohereError}});Object.defineProperty(Gi,"CohereTimeoutError",{enumerable:!0,get:function(){return Qmt.CohereTimeoutError}});var Wjr=Zmt();Object.defineProperty(Gi,"SagemakerClient",{enumerable:!0,get:function(){return Wjr.SagemakerClient}})});function Rg(t){t?(Al[0]=Al[16]=Al[1]=Al[2]=Al[3]=Al[4]=Al[5]=Al[6]=Al[7]=Al[8]=Al[9]=Al[10]=Al[11]=Al[12]=Al[13]=Al[14]=Al[15]=0,this.blocks=Al):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var Jjr,Br,Gjr,Ag,Al,nSe,egt=C(()=>{"use strict";Jjr=typeof window=="object"?window:{},Br="0123456789abcdef".split(""),Gjr=[-2147483648,8388608,32768,128],Ag=[24,16,8,0],Al=[];Rg.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===Jjr.ArrayBuffer&&(t=new Uint8Array(t));for(var r,n=0,o,i=t.length||0,a=this.blocks;n<i;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)for(o=this.start;n<i&&o<64;++n)a[o>>2]|=t[n]<<Ag[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<Ag[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<Ag[o++&3],a[o>>2]|=(128|r&63)<<Ag[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<Ag[o++&3],a[o>>2]|=(128|r>>6&63)<<Ag[o++&3],a[o>>2]|=(128|r&63)<<Ag[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<Ag[o++&3],a[o>>2]|=(128|r>>12&63)<<Ag[o++&3],a[o>>2]|=(128|r>>6&63)<<Ag[o++&3],a[o>>2]|=(128|r&63)<<Ag[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}};Rg.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=Gjr[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Rg.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i,a,s,u=this.blocks;for(a=16;a<80;++a)s=u[a-3]^u[a-8]^u[a-14]^u[a-16],u[a]=s<<1|s>>>31;for(a=0;a<20;a+=5)i=e&r|~e&n,s=t<<5|t>>>27,o=s+i+o+1518500249+u[a]<<0,e=e<<30|e>>>2,i=t&e|~t&r,s=o<<5|o>>>27,n=s+i+n+1518500249+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|~o&e,s=n<<5|n>>>27,r=s+i+r+1518500249+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|~n&t,s=r<<5|r>>>27,e=s+i+e+1518500249+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|~r&o,s=e<<5|e>>>27,t=s+i+t+1518500249+u[a+4]<<0,r=r<<30|r>>>2;for(;a<40;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o+1859775393+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n+1859775393+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r+1859775393+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e+1859775393+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t+1859775393+u[a+4]<<0,r=r<<30|r>>>2;for(;a<60;a+=5)i=e&r|e&n|r&n,s=t<<5|t>>>27,o=s+i+o-1894007588+u[a]<<0,e=e<<30|e>>>2,i=t&e|t&r|e&r,s=o<<5|o>>>27,n=s+i+n-1894007588+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|o&e|t&e,s=n<<5|n>>>27,r=s+i+r-1894007588+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|n&t|o&t,s=r<<5|r>>>27,e=s+i+e-1894007588+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|r&o|n&o,s=e<<5|e>>>27,t=s+i+t-1894007588+u[a+4]<<0,r=r<<30|r>>>2;for(;a<80;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o-899497514+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n-899497514+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r-899497514+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e-899497514+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t-899497514+u[a+4]<<0,r=r<<30|r>>>2;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0};Rg.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return Br[t>>28&15]+Br[t>>24&15]+Br[t>>20&15]+Br[t>>16&15]+Br[t>>12&15]+Br[t>>8&15]+Br[t>>4&15]+Br[t&15]+Br[e>>28&15]+Br[e>>24&15]+Br[e>>20&15]+Br[e>>16&15]+Br[e>>12&15]+Br[e>>8&15]+Br[e>>4&15]+Br[e&15]+Br[r>>28&15]+Br[r>>24&15]+Br[r>>20&15]+Br[r>>16&15]+Br[r>>12&15]+Br[r>>8&15]+Br[r>>4&15]+Br[r&15]+Br[n>>28&15]+Br[n>>24&15]+Br[n>>20&15]+Br[n>>16&15]+Br[n>>12&15]+Br[n>>8&15]+Br[n>>4&15]+Br[n&15]+Br[o>>28&15]+Br[o>>24&15]+Br[o>>20&15]+Br[o>>16&15]+Br[o>>12&15]+Br[o>>8&15]+Br[o>>4&15]+Br[o&15]};Rg.prototype.toString=Rg.prototype.hex;Rg.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24&255,r>>16&255,r>>8&255,r&255,n>>24&255,n>>16&255,n>>8&255,n&255,o>>24&255,o>>16&255,o>>8&255,o&255]};Rg.prototype.array=Rg.prototype.digest;Rg.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),t};nSe=t=>new Rg(!0).update(t).hex()});var tgt=C(()=>{egt()});var rgt,oSe,Kjr,ZF,ngt=C(()=>{tgt();ZO();rgt=(...t)=>nSe(t.join("_")),oSe=class{},Kjr=new Map,ZF=class extends oSe{constructor(e){super(),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(rgt(e,r))??null)}async update(e,r,n){this.cache.set(rgt(e,r),n)}static global(){return new ZF(Kjr)}}});function Qjr(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;o<r.length-1;o++){let i=t.slice(r[o].start,r[o+1].end),a=e.get(i.join(","));a!=null&&(n==null||a<n[0])&&(n=[a,o])}if(n!=null){let o=n[1];r[o]={start:r[o].start,end:r[o+1].end},r.splice(o+1,1)}else break}return r}function eNr(t,e){return t.length===1?[e.get(t.join(","))]:Qjr(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function tNr(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function aSe(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":return"o200k_base";default:throw new Error("Unknown model")}}var ogt,Yjr,Xjr,Zjr,iSe,aZ,igt=C(()=>{ogt=B(_fe(),1),Yjr=Object.defineProperty,Xjr=(t,e,r)=>e in t?Yjr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zjr=(t,e,r)=>(Xjr(t,typeof e!="symbol"?e+"":e,r),r);iSe=class{constructor(t,e){Vl(this,"specialTokens");Vl(this,"inverseSpecialTokens");Vl(this,"patStr");Vl(this,"textEncoder",new TextEncoder);Vl(this,"textDecoder",new TextDecoder("utf-8"));Vl(this,"rankMap",new Map);Vl(this,"textMap",new Map);this.patStr=t.pat_str;let r=t.bpe_ranks.split(`
`).filter(Boolean).reduce((n,o)=>{let[i,a,...s]=o.split(" "),u=Number.parseInt(a,10);return s.forEach((l,c)=>n[l]=u+c),n},{});for(let[n,o]of Object.entries(r)){let i=ogt.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=iSe.specialTokenRegex(Object.keys(this.specialTokens)),i=[],a=new Set(e==="all"?Object.keys(this.specialTokens):e),s=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!a.has(l)):r);if(s.size>0){let l=iSe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){i.push(m);continue}i.push(...eNr(h,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;i<t.length;++i){let a=t[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(e.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},aZ=iSe;Zjr(aZ,"specialTokenRegex",t=>new RegExp(t.map(e=>tNr(e)).join("|"),"g"))});var agt=C(()=>{igt()});async function sgt(t){return t in sZ||(sZ[t]=rNr.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new aZ(e)).catch(e=>{throw delete sZ[t],e})),await sZ[t]}async function ugt(t){return sgt(aSe(t))}var sZ,rNr,sSe=C(()=>{agt();Rj();sZ={},rNr=new lp({})});function Vw(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var nNr,oNr,QF,ek,c3=C(()=>{ngt();Kq();ZO();Rj();sSe();hf();nNr=t=>t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t;oNr=()=>!1,QF=class extends nn{get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.verbose=e.verbose??oNr(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},ek=class extends QF{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_encoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof o=="object"?this.cache=o:o?this.cache=ZF.global():this.cache=void 0,this.caller=new lp(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await ugt("modelName"in this?nNr(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new jj(e):Array.isArray(e)?new Nj(e.map(Vm)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([a,s])=>s!==void 0).map(([a,s])=>`${a}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}}});var uC=C(()=>{c3()});var Vh=C(()=>{Aj()});var R_t=b(()=>{});var ln=b((dQ,I_t)=>{(function(t,e){typeof dQ=="object"?I_t.exports=dQ=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(dQ,function(){var t=t||function(e,r){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof window<"u"&&window.crypto&&(n=window.crypto),!n&&typeof require=="function")try{n=R_t()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(_){var S;return g.prototype=_,S=new g,g.prototype=null,S}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var _=i(this);return g&&_.mixIn(g),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var _ in g)g.hasOwnProperty(_)&&(this[_]=g[_]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,_){g=this.words=g||[],_!=r?this.sigBytes=_:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var _=this.words,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;_[x+T>>>2]|=E<<24-(x+T)%4*8}else for(var M=0;M<O;M+=4)_[x+M>>>2]=S[M>>>2];return this.sigBytes+=O,this},clamp:function(){var g=this.words,_=this.sigBytes;g[_>>>2]&=4294967295<<32-_%4*8,g.length=e.ceil(_/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var _=[],S=0;S<g;S+=4)_.push(o());return new l.init(_,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var _=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var T=_[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 _=g.length,S=[],x=0;x<_;x+=2)S[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(S,_/2)}},f=c.Latin1={stringify:function(g){for(var _=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var T=_[O>>>2]>>>24-O%4*8&255;x.push(String.fromCharCode(T))}return x.join("")},parse:function(g){for(var _=g.length,S=[],x=0;x<_;x++)S[x>>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(S,_)}},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 _,S=this._data,x=S.words,O=S.sigBytes,T=this.blockSize,E=T*4,M=O/E;g?M=e.ceil(M):M=e.max((M|0)-this._minBufferSize,0);var R=M*T,N=e.min(R*4,O);if(R){for(var j=0;j<R;j+=T)this._doProcessBlock(x,j);_=x.splice(0,R),S.sigBytes-=N}return new l.init(_,N)},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 _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(g){return function(_,S){return new g.init(S).finalize(_)}},_createHmacHelper:function(g){return function(_,S){return new v.HMAC.init(g,S).finalize(_)}}}),v=a.algo={};return a}(Math);return t})});var $3=b((fQ,D_t)=>{(function(t,e){typeof fQ=="object"?D_t.exports=fQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(fQ,function(t){return function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=r.x64={},s=a.Word=o.extend({init:function(l,c){this.high=l,this.low=c}}),u=a.WordArray=o.extend({init:function(l,c){l=this.words=l||[],c!=e?this.sigBytes=c:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,c=l.length,d=[],f=0;f<c;f++){var p=l[f];d.push(p.high),d.push(p.low)}return i.create(d,this.sigBytes)},clone:function(){for(var l=o.clone.call(this),c=l.words=this.words.slice(0),d=c.length,f=0;f<d;f++)c[f]=c[f].clone();return l}})}(),t})});var N_t=b((pQ,j_t)=>{(function(t,e){typeof pQ=="object"?j_t.exports=pQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(pQ,function(t){return function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,o=n.init,i=n.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray<"u"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var s=a.byteLength,u=[],l=0;l<s;l++)u[l>>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),t.lib.WordArray})});var F_t=b((hQ,L_t)=>{(function(t,e){typeof hQ=="object"?L_t.exports=hQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(hQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Utf16=o.Utf16BE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=u[d>>>2]>>>16-d%4*8&65535;c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=s.charCodeAt(c)<<16-c%2*16;return n.create(l,u*2)}};o.Utf16LE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=a(u[d>>>2]>>>16-d%4*8&65535);c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=a(s.charCodeAt(c)<<16-c%2*16);return n.create(l,u*2)}};function a(s){return s<<8&4278255360|s>>>8&16711935}}(),t.enc.Utf16})});var lT=b((mQ,k_t)=>{(function(t,e){typeof mQ=="object"?k_t.exports=mQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(mQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,h=u[f+1>>>2]>>>24-(f+1)%4*8&255,m=u[f+2>>>2]>>>24-(f+2)%4*8&255,v=p<<16|h<<8|m,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(v>>>6*(3-g)&63));var _=c.charAt(64);if(_)for(;d.length%4;)d.push(_);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var $_t=b((gQ,B_t)=>{(function(t,e){typeof gQ=="object"?B_t.exports=gQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(gQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var h=l[p>>>2]>>>24-p%4*8&255,m=l[p+1>>>2]>>>24-(p+1)%4*8&255,v=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=h<<16|m<<8|v,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(g>>>6*(3-_)&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)}}(),t.enc.Base64url})});var cT=b((yQ,q_t)=>{(function(t,e){typeof yQ=="object"?q_t.exports=yQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yQ,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,h){for(var m=0;m<16;m++){var v=h+m,g=p[v];p[v]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var _=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],R=p[h+6],N=p[h+7],j=p[h+8],k=p[h+9],F=p[h+10],L=p[h+11],q=p[h+12],U=p[h+13],G=p[h+14],V=p[h+15],I=_[0],H=_[1],W=_[2],J=_[3];I=l(I,H,W,J,S,7,s[0]),J=l(J,I,H,W,x,12,s[1]),W=l(W,J,I,H,O,17,s[2]),H=l(H,W,J,I,T,22,s[3]),I=l(I,H,W,J,E,7,s[4]),J=l(J,I,H,W,M,12,s[5]),W=l(W,J,I,H,R,17,s[6]),H=l(H,W,J,I,N,22,s[7]),I=l(I,H,W,J,j,7,s[8]),J=l(J,I,H,W,k,12,s[9]),W=l(W,J,I,H,F,17,s[10]),H=l(H,W,J,I,L,22,s[11]),I=l(I,H,W,J,q,7,s[12]),J=l(J,I,H,W,U,12,s[13]),W=l(W,J,I,H,G,17,s[14]),H=l(H,W,J,I,V,22,s[15]),I=c(I,H,W,J,x,5,s[16]),J=c(J,I,H,W,R,9,s[17]),W=c(W,J,I,H,L,14,s[18]),H=c(H,W,J,I,S,20,s[19]),I=c(I,H,W,J,M,5,s[20]),J=c(J,I,H,W,F,9,s[21]),W=c(W,J,I,H,V,14,s[22]),H=c(H,W,J,I,E,20,s[23]),I=c(I,H,W,J,k,5,s[24]),J=c(J,I,H,W,G,9,s[25]),W=c(W,J,I,H,T,14,s[26]),H=c(H,W,J,I,j,20,s[27]),I=c(I,H,W,J,U,5,s[28]),J=c(J,I,H,W,O,9,s[29]),W=c(W,J,I,H,N,14,s[30]),H=c(H,W,J,I,q,20,s[31]),I=d(I,H,W,J,M,4,s[32]),J=d(J,I,H,W,j,11,s[33]),W=d(W,J,I,H,L,16,s[34]),H=d(H,W,J,I,G,23,s[35]),I=d(I,H,W,J,x,4,s[36]),J=d(J,I,H,W,E,11,s[37]),W=d(W,J,I,H,N,16,s[38]),H=d(H,W,J,I,F,23,s[39]),I=d(I,H,W,J,U,4,s[40]),J=d(J,I,H,W,S,11,s[41]),W=d(W,J,I,H,T,16,s[42]),H=d(H,W,J,I,R,23,s[43]),I=d(I,H,W,J,k,4,s[44]),J=d(J,I,H,W,q,11,s[45]),W=d(W,J,I,H,V,16,s[46]),H=d(H,W,J,I,O,23,s[47]),I=f(I,H,W,J,S,6,s[48]),J=f(J,I,H,W,N,10,s[49]),W=f(W,J,I,H,G,15,s[50]),H=f(H,W,J,I,M,21,s[51]),I=f(I,H,W,J,q,6,s[52]),J=f(J,I,H,W,T,10,s[53]),W=f(W,J,I,H,F,15,s[54]),H=f(H,W,J,I,x,21,s[55]),I=f(I,H,W,J,j,6,s[56]),J=f(J,I,H,W,V,10,s[57]),W=f(W,J,I,H,R,15,s[58]),H=f(H,W,J,I,U,21,s[59]),I=f(I,H,W,J,E,6,s[60]),J=f(J,I,H,W,L,10,s[61]),W=f(W,J,I,H,O,15,s[62]),H=f(H,W,J,I,k,21,s[63]),_[0]=_[0]+I|0,_[1]=_[1]+H|0,_[2]=_[2]+W|0,_[3]=_[3]+J|0},_doFinalize:function(){var p=this._data,h=p.words,m=this._nDataBytes*8,v=p.sigBytes*8;h[v>>>5]|=128<<24-v%32;var g=e.floor(m/4294967296),_=m;h[(v+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,h[(v+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>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,v,g,_,S){var x=p+(h&m|~h&v)+g+S;return(x<<_|x>>>32-_)+h}function c(p,h,m,v,g,_,S){var x=p+(h&v|m&~v)+g+S;return(x<<_|x>>>32-_)+h}function d(p,h,m,v,g,_,S){var x=p+(h^m^v)+g+S;return(x<<_|x>>>32-_)+h}function f(p,h,m,v,g,_,S){var x=p+(m^(h|~v))+g+S;return(x<<_|x>>>32-_)+h}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var Jxe=b((bQ,U_t)=>{(function(t,e){typeof bQ=="object"?U_t.exports=bQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(bQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],h=c[3],m=c[4],v=0;v<80;v++){if(v<16)a[v]=u[l+v]|0;else{var g=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=g<<1|g>>>31}var _=(d<<5|d>>>27)+m+a[v];v<20?_+=(f&p|~f&h)+1518500249:v<40?_+=(f^p^h)+1859775393:v<60?_+=(f&p|f&h|p&h)-1894007588:_+=(f^p^h)-899497514,m=h,h=p,p=f<<30|f>>>2,f=d,d=_}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+h|0,c[4]=c[4]+m|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var vQ=b((_Q,z_t)=>{(function(t,e){typeof _Q=="object"?z_t.exports=_Q=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(_Q,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(m){for(var v=e.sqrt(m),g=2;g<=v;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(e.pow(p,1/2))),u[h]=f(e.pow(p,1/3)),h++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,h=p[0],m=p[1],v=p[2],g=p[3],_=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,R=l[T-2],N=(R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10;l[T]=M+l[T-7]+N+l[T-16]}var j=_&S^~_&x,k=h&m^h&v^m&v,F=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),L=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),q=O+L+j+u[T]+l[T],U=F+k;O=x,x=S,S=_,_=g+q|0,g=v,v=m,m=h,h=q+U|0}p[0]=p[0]+h|0,p[1]=p[1]+m|0,p[2]=p[2]+v|0,p[3]=p[3]+g|0,p[4]=p[4]+_|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]=e.floor(p/4294967296),f[(h+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var V_t=b((wQ,H_t)=>{(function(t,e,r){typeof wQ=="object"?H_t.exports=wQ=e(ln(),vQ()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(wQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.algo,i=o.SHA256,a=o.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var s=i._doFinalize.call(this);return s.sigBytes-=4,s}});e.SHA224=i._createHelper(a),e.HmacSHA224=i._createHmacHelper(a)}(),t.SHA224})});var Gxe=b((SQ,W_t)=>{(function(t,e,r){typeof SQ=="object"?W_t.exports=SQ=e(ln(),$3()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(SQ,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var h=this._hash.words,m=h[0],v=h[1],g=h[2],_=h[3],S=h[4],x=h[5],O=h[6],T=h[7],E=m.high,M=m.low,R=v.high,N=v.low,j=g.high,k=g.low,F=_.high,L=_.low,q=S.high,U=S.low,G=x.high,V=x.low,I=O.high,H=O.low,W=T.high,J=T.low,re=E,Ae=M,Y=R,Q=N,le=j,Re=k,gt=F,Se=L,ae=q,ee=U,ye=G,Ue=V,ft=I,Je=H,cr=W,Yr=J,dr=0;dr<80;dr++){var qt,Uo,ra=c[dr];if(dr<16)Uo=ra.high=f[p+dr*2]|0,qt=ra.low=f[p+dr*2+1]|0;else{var Fo=c[dr-15],Ie=Fo.high,Xe=Fo.low,fr=(Ie>>>1|Xe<<31)^(Ie>>>8|Xe<<24)^Ie>>>7,Ze=(Xe>>>1|Ie<<31)^(Xe>>>8|Ie<<24)^(Xe>>>7|Ie<<25),$n=c[dr-2],na=$n.high,hl=$n.low,Fc=(na>>>19|hl<<13)^(na<<3|hl>>>29)^na>>>6,km=(hl>>>19|na<<13)^(hl<<3|na>>>29)^(hl>>>6|na<<26),Bm=c[dr-7],Da=Bm.high,th=Bm.low,ep=c[dr-16],rh=ep.high,gn=ep.low;qt=Ze+th,Uo=fr+Da+(qt>>>0<Ze>>>0?1:0),qt=qt+km,Uo=Uo+Fc+(qt>>>0<km>>>0?1:0),qt=qt+gn,Uo=Uo+rh+(qt>>>0<gn>>>0?1:0),ra.high=Uo,ra.low=qt}var $O=ae&ye^~ae&ft,WM=ee&Ue^~ee&Je,qO=re&Y^re&le^Y&le,ja=Ae&Q^Ae&Re^Q&Re,hs=(re>>>28|Ae<<4)^(re<<30|Ae>>>2)^(re<<25|Ae>>>7),oa=(Ae>>>28|re<<4)^(Ae<<30|re>>>2)^(Ae<<25|re>>>7),wd=(ae>>>14|ee<<18)^(ae>>>18|ee<<14)^(ae<<23|ee>>>9),kc=(ee>>>14|ae<<18)^(ee>>>18|ae<<14)^(ee<<23|ae>>>9),Ya=l[dr],rf=Ya.high,Sd=Ya.low,rn=Yr+kc,je=cr+wd+(rn>>>0<Yr>>>0?1:0),rn=rn+WM,je=je+$O+(rn>>>0<WM>>>0?1:0),rn=rn+Sd,je=je+rf+(rn>>>0<Sd>>>0?1:0),rn=rn+qt,je=je+Uo+(rn>>>0<qt>>>0?1:0),xd=oa+ja,tp=hs+qO+(xd>>>0<oa>>>0?1:0);cr=ft,Yr=Je,ft=ye,Je=Ue,ye=ae,Ue=ee,ee=Se+rn|0,ae=gt+je+(ee>>>0<Se>>>0?1:0)|0,gt=le,Se=Re,le=Y,Re=Q,Y=re,Q=Ae,Ae=rn+xd|0,re=je+tp+(Ae>>>0<rn>>>0?1:0)|0}M=m.low=M+Ae,m.high=E+re+(M>>>0<Ae>>>0?1:0),N=v.low=N+Q,v.high=R+Y+(N>>>0<Q>>>0?1:0),k=g.low=k+Re,g.high=j+le+(k>>>0<Re>>>0?1:0),L=_.low=L+Se,_.high=F+gt+(L>>>0<Se>>>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+ye+(V>>>0<Ue>>>0?1:0),H=O.low=H+Je,O.high=I+ft+(H>>>0<Je>>>0?1:0),J=T.low=J+Yr,T.high=W+cr+(J>>>0<Yr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,h=this._nDataBytes*8,m=f.sigBytes*8;p[m>>>5]|=128<<24-m%32,p[(m+128>>>10<<5)+30]=Math.floor(h/4294967296),p[(m+128>>>10<<5)+31]=h,f.sigBytes=p.length*4,this._process();var v=this._hash.toX32();return v},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var G_t=b((xQ,J_t)=>{(function(t,e,r){typeof xQ=="object"?J_t.exports=xQ=e(ln(),$3(),Gxe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(xQ,function(t){return function(){var e=t,r=e.x64,n=r.Word,o=r.WordArray,i=e.algo,a=i.SHA512,s=i.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=16,u}});e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s)}(),t.SHA384})});var Y_t=b((CQ,K_t)=>{(function(t,e,r){typeof CQ=="object"?K_t.exports=CQ=e(ln(),$3()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(CQ,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var h=1,m=0,v=0;v<24;v++){l[h+5*m]=(v+1)*(v+2)/2%64;var g=m%5,_=(2*h+3*m)%5;h=g,m=_}for(var h=0;h<5;h++)for(var m=0;m<5;m++)c[h+5*m]=m+(2*h+3*m)%5*5;for(var 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 v=this._state,g=this.blockSize/2,_=0;_<g;_++){var S=h[m+2*_],x=h[m+2*_+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,R=0,N=0;N<5;N++){var O=v[E+5*N];M^=O.high,R^=O.low}var j=f[E];j.high=M,j.low=R}for(var E=0;E<5;E++)for(var k=f[(E+4)%5],F=f[(E+1)%5],L=F.high,q=F.low,M=k.high^(L<<1|q>>>31),R=k.low^(q<<1|L>>>31),N=0;N<5;N++){var O=v[E+5*N];O.high^=M,O.low^=R}for(var U=1;U<25;U++){var M,R,O=v[U],G=O.high,V=O.low,I=l[U];I<32?(M=G<<I|V>>>32-I,R=V<<I|G>>>32-I):(M=V<<I-32|G>>>64-I,R=G<<I-32|V>>>64-I);var H=f[c[U]];H.high=M,H.low=R}var W=f[0],J=v[0];W.high=J.high,W.low=J.low;for(var E=0;E<5;E++)for(var N=0;N<5;N++){var U=E+5*N,O=v[U],re=f[U],Ae=f[(E+1)%5+5*N],Y=f[(E+2)%5+5*N];O.high=re.high^~Ae.high&Y.high,O.low=re.low^~Ae.low&Y.low}var O=v[0],Q=d[T];O.high^=Q.high,O.low^=Q.low}},_doFinalize:function(){var h=this._data,m=h.words,v=this._nDataBytes*8,g=h.sigBytes*8,_=this.blockSize*32;m[g>>>5]|=1<<24-g%32,m[(e.ceil((g+1)/_)*_>>>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],R=M.high,N=M.low;R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,T.push(N),T.push(R)}return new o.init(T,x)},clone:function(){for(var h=i.clone.call(this),m=h._state=this._state.slice(0),v=0;v<25;v++)m[v]=m[v].clone();return h}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var Z_t=b((OQ,X_t)=>{(function(t,e){typeof OQ=="object"?X_t.exports=OQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(OQ,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,O){for(var 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 R=this._hash.words,N=d.words,j=f.words,k=s.words,F=u.words,L=l.words,q=c.words,U,G,V,I,H,W,J,re,Ae,Y;W=U=R[0],J=G=R[1],re=V=R[2],Ae=I=R[3],Y=H=R[4];for(var Q,T=0;T<80;T+=1)Q=U+x[O+k[T]]|0,T<16?Q+=h(G,V,I)+N[0]:T<32?Q+=m(G,V,I)+N[1]:T<48?Q+=v(G,V,I)+N[2]:T<64?Q+=g(G,V,I)+N[3]:Q+=_(G,V,I)+N[4],Q=Q|0,Q=S(Q,L[T]),Q=Q+H|0,U=H,H=I,I=S(V,10),V=G,G=Q,Q=W+x[O+F[T]]|0,T<16?Q+=_(J,re,Ae)+j[0]:T<32?Q+=g(J,re,Ae)+j[1]:T<48?Q+=v(J,re,Ae)+j[2]:T<64?Q+=m(J,re,Ae)+j[3]:Q+=h(J,re,Ae)+j[4],Q=Q|0,Q=S(Q,q[T]),Q=Q+Y|0,W=Y,Y=Ae,Ae=S(re,10),re=J,J=Q;Q=R[1]+V+Ae|0,R[1]=R[2]+I+Y|0,R[2]=R[3]+H+W|0,R[3]=R[4]+U+J|0,R[4]=R[0]+G+re|0,R[0]=Q},_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,R=M.words,N=0;N<5;N++){var j=R[N];R[N]=(j<<8|j>>>24)&16711935|(j<<24|j>>>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 v(x,O,T){return(x|~O)^T}function g(x,O,T){return x&T|O&~T}function _(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),t.RIPEMD160})});var PQ=b((EQ,Q_t)=>{(function(t,e){typeof EQ=="object"?Q_t.exports=EQ=e(ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(EQ,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),h=f.words,m=p.words,v=0;v<c;v++)h[v]^=1549556828,m[v]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var l=this._hasher,c=l.finalize(u);l.reset();var d=l.finalize(this._oKey.clone().concat(c));return d}})})()})});var tvt=b((TQ,evt)=>{(function(t,e,r){typeof TQ=="object"?evt.exports=TQ=e(ln(),vQ(),PQ()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(TQ,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),h=o.create([1]),m=p.words,v=h.words,g=d.keySize,_=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<_;E++){T=f.finalize(T),f.reset();for(var M=T.words,R=0;R<O;R++)x[R]^=M[R]}p.concat(S),v[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var bC=b((MQ,rvt)=>{(function(t,e,r){typeof MQ=="object"?rvt.exports=MQ=e(ln(),Jxe(),PQ()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(MQ,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),h=p.words,m=d.keySize,v=d.iterations;h.length<m;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<v;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=m*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var al=b((AQ,nvt)=>{(function(t,e,r){typeof AQ=="object"?nvt.exports=AQ=e(ln(),bC()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(AQ,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc,u=s.Utf8,l=s.Base64,c=r.algo,d=c.EvpKDF,f=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(j,k){return this.create(this._ENC_XFORM_MODE,j,k)},createDecryptor:function(j,k){return this.create(this._DEC_XFORM_MODE,j,k)},init:function(j,k,F){this.cfg=this.cfg.extend(F),this._xformMode=j,this._key=k,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(j){return this._append(j),this._process()},finalize:function(j){j&&this._append(j);var k=this._doFinalize();return k},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function j(k){return typeof k=="string"?N:E}return function(k){return{encrypt:function(F,L,q){return j(L).encrypt(k,F,L,q)},decrypt:function(F,L,q){return j(L).decrypt(k,F,L,q)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var j=this._process(!0);return j},blockSize:1}),h=r.mode={},m=n.BlockCipherMode=o.extend({createEncryptor:function(j,k){return this.Encryptor.create(j,k)},createDecryptor:function(j,k){return this.Decryptor.create(j,k)},init:function(j,k){this._cipher=j,this._iv=k}}),v=h.CBC=function(){var j=m.extend();j.Encryptor=j.extend({processBlock:function(F,L){var q=this._cipher,U=q.blockSize;k.call(this,F,L,U),q.encryptBlock(F,L),this._prevBlock=F.slice(L,L+U)}}),j.Decryptor=j.extend({processBlock:function(F,L){var q=this._cipher,U=q.blockSize,G=F.slice(L,L+U);q.decryptBlock(F,L),k.call(this,F,L,U),this._prevBlock=G}});function k(F,L,q){var U,G=this._iv;G?(U=G,this._iv=e):U=this._prevBlock;for(var V=0;V<q;V++)F[L+V]^=U[V]}return j}(),g=r.pad={},_=g.Pkcs7={pad:function(j,k){for(var F=k*4,L=F-j.sigBytes%F,q=L<<24|L<<16|L<<8|L,U=[],G=0;G<L;G+=4)U.push(q);var V=i.create(U,L);j.concat(V)},unpad:function(j){var k=j.words[j.sigBytes-1>>>2]&255;j.sigBytes-=k}},S=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:v,padding:_}),reset:function(){var j;f.reset.call(this);var k=this.cfg,F=k.iv,L=k.mode;this._xformMode==this._ENC_XFORM_MODE?j=L.createEncryptor:(j=L.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==j?this._mode.init(this,F&&F.words):(this._mode=j.call(L,this,F&&F.words),this._mode.__creator=j)},_doProcessBlock:function(j,k){this._mode.processBlock(j,k)},_doFinalize:function(){var j,k=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(k.pad(this._data,this.blockSize),j=this._process(!0)):(j=this._process(!0),k.unpad(j)),j},blockSize:128/32}),x=n.CipherParams=o.extend({init:function(j){this.mixIn(j)},toString:function(j){return(j||this.formatter).stringify(this)}}),O=r.format={},T=O.OpenSSL={stringify:function(j){var k,F=j.ciphertext,L=j.salt;return L?k=i.create([1398893684,1701076831]).concat(L).concat(F):k=F,k.toString(l)},parse:function(j){var k,F=l.parse(j),L=F.words;return L[0]==1398893684&&L[1]==1701076831&&(k=i.create(L.slice(2,4)),L.splice(0,4),F.sigBytes-=16),x.create({ciphertext:F,salt:k})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:T}),encrypt:function(j,k,F,L){L=this.cfg.extend(L);var q=j.createEncryptor(F,L),U=q.finalize(k),G=q.cfg;return x.create({ciphertext:U,key:F,iv:G.iv,algorithm:j,mode:G.mode,padding:G.padding,blockSize:j.blockSize,formatter:L.format})},decrypt:function(j,k,F,L){L=this.cfg.extend(L),k=this._parse(k,L.format);var q=j.createDecryptor(F,L).finalize(k.ciphertext);return q},_parse:function(j,k){return typeof j=="string"?k.parse(j,this):j}}),M=r.kdf={},R=M.OpenSSL={execute:function(j,k,F,L,q){if(L||(L=i.random(64/8)),q)var U=d.create({keySize:k+F,hasher:q}).compute(j,L);else var U=d.create({keySize:k+F}).compute(j,L);var G=i.create(U.words.slice(k),F*4);return U.sigBytes=k*4,x.create({key:U,iv:G,salt:L})}},N=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:R}),encrypt:function(j,k,F,L){L=this.cfg.extend(L);var q=L.kdf.execute(F,j.keySize,j.ivSize,L.salt,L.hasher);L.iv=q.iv;var U=E.encrypt.call(this,j,k,q.key,L);return U.mixIn(q),U},decrypt:function(j,k,F,L){L=this.cfg.extend(L),k=this._parse(k,L.format);var q=L.kdf.execute(F,j.keySize,j.ivSize,k.salt,L.hasher);L.iv=q.iv;var U=E.decrypt.call(this,j,k,q.key,L);return U}})}()})});var ivt=b((RQ,ovt)=>{(function(t,e,r){typeof RQ=="object"?ovt.exports=RQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(RQ,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize;r.call(this,n,o,a,i),this._prevBlock=n.slice(o,o+a)}}),e.Decryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=n.slice(o,o+a);r.call(this,n,o,a,i),this._prevBlock=s}});function r(n,o,i,a){var s,u=this._iv;u?(s=u.slice(0),this._iv=void 0):s=this._prevBlock,a.encryptBlock(s,0);for(var l=0;l<i;l++)n[o+l]^=s[l]}return e}(),t.mode.CFB})});var svt=b((IQ,avt)=>{(function(t,e,r){typeof IQ=="object"?avt.exports=IQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(IQ,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._counter;s&&(u=this._counter=s.slice(0),this._iv=void 0);var l=u.slice(0);i.encryptBlock(l,0),u[a-1]=u[a-1]+1|0;for(var c=0;c<a;c++)n[o+c]^=l[c]}});return e.Decryptor=r,e}(),t.mode.CTR})});var lvt=b((DQ,uvt)=>{(function(t,e,r){typeof DQ=="object"?uvt.exports=DQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(DQ,function(t){return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function r(i){if((i>>24&255)===255){var a=i>>16&255,s=i>>8&255,u=i&255;a===255?(a=0,s===255?(s=0,u===255?u=0:++u):++s):++a,i=0,i+=a<<16,i+=s<<8,i+=u}else i+=1<<24;return i}function n(i){return(i[0]=r(i[0]))===0&&(i[1]=r(i[1])),i}var o=e.Encryptor=e.extend({processBlock:function(i,a){var s=this._cipher,u=s.blockSize,l=this._iv,c=this._counter;l&&(c=this._counter=l.slice(0),this._iv=void 0),n(c);var d=c.slice(0);s.encryptBlock(d,0);for(var f=0;f<u;f++)i[a+f]^=d[f]}});return e.Decryptor=o,e}(),t.mode.CTRGladman})});var dvt=b((jQ,cvt)=>{(function(t,e,r){typeof jQ=="object"?cvt.exports=jQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(jQ,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._keystream;s&&(u=this._keystream=s.slice(0),this._iv=void 0),i.encryptBlock(u,0);for(var l=0;l<a;l++)n[o+l]^=u[l]}});return e.Decryptor=r,e}(),t.mode.OFB})});var pvt=b((NQ,fvt)=>{(function(t,e,r){typeof NQ=="object"?fvt.exports=NQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(NQ,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(r,n){this._cipher.encryptBlock(r,n)}}),e.Decryptor=e.extend({processBlock:function(r,n){this._cipher.decryptBlock(r,n)}}),e}(),t.mode.ECB})});var mvt=b((LQ,hvt)=>{(function(t,e,r){typeof LQ=="object"?hvt.exports=LQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(LQ,function(t){return t.pad.AnsiX923={pad:function(e,r){var n=e.sigBytes,o=r*4,i=o-n%o,a=n+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Ansix923})});var yvt=b((FQ,gvt)=>{(function(t,e,r){typeof FQ=="object"?gvt.exports=FQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(FQ,function(t){return t.pad.Iso10126={pad:function(e,r){var n=r*4,o=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Iso10126})});var _vt=b((kQ,bvt)=>{(function(t,e,r){typeof kQ=="object"?bvt.exports=kQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(kQ,function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})});var wvt=b((BQ,vvt)=>{(function(t,e,r){typeof BQ=="object"?vvt.exports=BQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(BQ,function(t){return t.pad.ZeroPadding={pad:function(e,r){var n=r*4;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var r=e.words,n=e.sigBytes-1,n=e.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},t.pad.ZeroPadding})});var xvt=b(($Q,Svt)=>{(function(t,e,r){typeof $Q=="object"?Svt.exports=$Q=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($Q,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var Ovt=b((qQ,Cvt)=>{(function(t,e,r){typeof qQ=="object"?Cvt.exports=qQ=e(ln(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(qQ,function(t){return function(e){var r=t,n=r.lib,o=n.CipherParams,i=r.enc,a=i.Hex,s=r.format,u=s.Hex={stringify:function(l){return l.ciphertext.toString(a)},parse:function(l){var c=a.parse(l);return o.create({ciphertext:c})}}}(),t.format.Hex})});var Pvt=b((UQ,Evt)=>{(function(t,e,r){typeof UQ=="object"?Evt.exports=UQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(UQ,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],h=[];(function(){for(var g=[],_=0;_<256;_++)_<128?g[_]=_<<1:g[_]=_<<1^283;for(var S=0,x=0,_=0;_<256;_++){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],R=g[O]*257^O*16843008;s[S]=R<<24|R>>>8,u[S]=R<<16|R>>>16,l[S]=R<<8|R>>>24,c[S]=R;var R=M*16843009^E*65537^T*257^S*16843008;d[O]=R<<24|R>>>8,f[O]=R<<16|R>>>16,p[O]=R<<8|R>>>24,h[O]=R,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],v=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,S=_.words,x=_.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 R=this._invKeySchedule=[],N=0;N<T;N++){var M=T-N;if(N%4)var g=E[M];else var g=E[M-4];N<4||M<=4?R[N]=g:R[N]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^h[i[g&255]]}}},encryptBlock:function(g,_){this._doCryptBlock(g,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,_){var S=g[_+1];g[_+1]=g[_+3],g[_+3]=S,this._doCryptBlock(g,_,this._invKeySchedule,d,f,p,h,a);var S=g[_+1];g[_+1]=g[_+3],g[_+3]=S},_doCryptBlock:function(g,_,S,x,O,T,E,M){for(var R=this._nRounds,N=g[_]^S[0],j=g[_+1]^S[1],k=g[_+2]^S[2],F=g[_+3]^S[3],L=4,q=1;q<R;q++){var U=x[N>>>24]^O[j>>>16&255]^T[k>>>8&255]^E[F&255]^S[L++],G=x[j>>>24]^O[k>>>16&255]^T[F>>>8&255]^E[N&255]^S[L++],V=x[k>>>24]^O[F>>>16&255]^T[N>>>8&255]^E[j&255]^S[L++],I=x[F>>>24]^O[N>>>16&255]^T[j>>>8&255]^E[k&255]^S[L++];N=U,j=G,k=V,F=I}var U=(M[N>>>24]<<24|M[j>>>16&255]<<16|M[k>>>8&255]<<8|M[F&255])^S[L++],G=(M[j>>>24]<<24|M[k>>>16&255]<<16|M[F>>>8&255]<<8|M[N&255])^S[L++],V=(M[k>>>24]<<24|M[F>>>16&255]<<16|M[N>>>8&255]<<8|M[j&255])^S[L++],I=(M[F>>>24]<<24|M[N>>>16&255]<<16|M[j>>>8&255]<<8|M[k&255])^S[L++];g[_]=U,g[_+1]=G,g[_+2]=V,g[_+3]=I},keySize:256/32});e.AES=n._createHelper(v)}(),t.AES})});var Mvt=b((zQ,Tvt)=>{(function(t,e,r){typeof zQ=="object"?Tvt.exports=zQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(zQ,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var m=this._key,v=m.words,g=[],_=0;_<56;_++){var S=a[_]-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],_=0;_<24;_++)T[_/6|0]|=g[(s[_]-1+E)%28]<<31-_%6,T[4+(_/6|0)]|=g[28+(s[_+24]-1+E)%28]<<31-_%6;T[0]=T[0]<<1|T[0]>>>31;for(var _=1;_<7;_++)T[_]=T[_]>>>(_-1)*4+3;T[7]=T[7]<<5|T[7]>>>27}for(var M=this._invSubKeys=[],_=0;_<16;_++)M[_]=x[15-_]},encryptBlock:function(m,v){this._doCryptBlock(m,v,this._subKeys)},decryptBlock:function(m,v){this._doCryptBlock(m,v,this._invSubKeys)},_doCryptBlock:function(m,v,g){this._lBlock=m[v],this._rBlock=m[v+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var _=0;_<16;_++){for(var S=g[_],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[v]=this._lBlock,m[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(m,v){var g=(this._lBlock>>>m^this._rBlock)&v;this._rBlock^=g,this._lBlock^=g<<m}function p(m,v){var g=(this._rBlock>>>m^this._lBlock)&v;this._lBlock^=g,this._rBlock^=g<<m}e.DES=o._createHelper(d);var h=i.TripleDES=o.extend({_doReset:function(){var m=this._key,v=m.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=v.slice(0,2),_=v.length<4?v.slice(0,2):v.slice(2,4),S=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(S))},encryptBlock:function(m,v){this._des1.encryptBlock(m,v),this._des2.decryptBlock(m,v),this._des3.encryptBlock(m,v)},decryptBlock:function(m,v){this._des3.decryptBlock(m,v),this._des2.encryptBlock(m,v),this._des1.decryptBlock(m,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(h)}(),t.TripleDES})});var Rvt=b((HQ,Avt)=>{(function(t,e,r){typeof HQ=="object"?Avt.exports=HQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(HQ,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var h=f%c,m=l[h>>>2]>>>24-h%4*8&255;p=(p+d[f]+m)%256;var v=d[f];d[f]=d[p],d[p]=v}this._i=this._j=0},_doProcessBlock:function(u,l){u[l]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var u=this._S,l=this._i,c=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,c=(c+u[l])%256;var p=u[l];u[l]=u[c],u[c]=p,d|=u[(u[l]+u[c])%256]<<24-f*8}return this._i=l,this._j=c,d}e.RC4=n._createHelper(i);var s=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)a.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})});var Dvt=b((VQ,Ivt)=>{(function(t,e,r){typeof VQ=="object"?Ivt.exports=VQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(VQ,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],h=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)h[f]^=p[f+4&7];if(d){var m=d.words,v=m[0],g=m[1],_=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|S&4294901760,O=S<<16|_&65535;h[0]^=_,h[1]^=x,h[2]^=S,h[3]^=O,h[4]^=_,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,v=((h*h>>>17)+h*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=v^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var Nvt=b((WQ,jvt)=>{(function(t,e,r){typeof WQ=="object"?jvt.exports=WQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(WQ,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var h=0;h<4;h++)l.call(this);for(var h=0;h<8;h++)p[h]^=f[h+4&7];if(d){var m=d.words,v=m[0],g=m[1],_=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|S&4294901760,O=S<<16|_&65535;p[0]^=_,p[1]^=x,p[2]^=S,p[3]^=O,p[4]^=_,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,v=((h*h>>>17)+h*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=v^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var Fvt=b((JQ,Lvt)=>{(function(t,e,r){typeof JQ=="object"?Lvt.exports=JQ=e(ln(),lT(),cT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(JQ,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(h,m){let v=m>>24&255,g=m>>16&255,_=m>>8&255,S=m&255,x=h.sbox[0][v]+h.sbox[1][g];return x=x^h.sbox[2][_],x=x+h.sbox[3][S],x}function c(h,m,v){let g=m,_=v,S;for(let x=0;x<i;++x)g=g^h.pbox[x],_=l(h,g)^_,S=g,g=_,_=S;return S=g,g=_,_=S,_=_^h.pbox[i],g=g^h.pbox[i+1],{left:g,right:_}}function d(h,m,v){let g=m,_=v,S;for(let x=i+1;x>1;--x)g=g^h.pbox[x],_=l(h,g)^_,S=g,g=_,_=S;return S=g,g=_,_=S,_=_^h.pbox[1],g=g^h.pbox[0],{left:g,right:_}}function f(h,m,v){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>=v&&(g=0);let _=0,S=0,x=0;for(let O=0;O<i+2;O+=2)x=c(h,_,S),_=x.left,S=x.right,h.pbox[O]=_,h.pbox[O+1]=S;for(let O=0;O<4;O++)for(let T=0;T<256;T+=2)x=c(h,_,S),_=x.left,S=x.right,h.sbox[O][T]=_,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,v=h.sigBytes/4;f(u,m,v)}},encryptBlock:function(h,m){var v=c(u,h[m],h[m+1]);h[m]=v.left,h[m+1]=v.right},decryptBlock:function(h,m){var v=d(u,h[m],h[m+1]);h[m]=v.left,h[m+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var KQ=b((GQ,kvt)=>{(function(t,e,r){typeof GQ=="object"?kvt.exports=GQ=e(ln(),$3(),N_t(),F_t(),lT(),$_t(),cT(),Jxe(),vQ(),V_t(),Gxe(),G_t(),Y_t(),Z_t(),PQ(),tvt(),bC(),al(),ivt(),svt(),lvt(),dvt(),pvt(),mvt(),yvt(),_vt(),wvt(),xvt(),Ovt(),Pvt(),Mvt(),Rvt(),Dvt(),Nvt(),Fvt()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(GQ,function(t){return t})});var _C,Hvt=C(()=>{_C=class{constructor(e){Object.defineProperty(this,"pageContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}}});var Vn=b(UCe=>{"use strict";Object.defineProperty(UCe,"__esModule",{value:!0});UCe.pathToFunc=rqr;var tqr=Object.prototype.hasOwnProperty;function rqr(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!tqr.call(o,a))throw new Error(`Parameter '${a}' is required`);let s=o[a];if(typeof s!="string"&&typeof s!="number")throw new Error(`Parameter '${a}' must be a string or number`);return e?.charEncoding==="percent"?encodeURIComponent(`${s}`):`${s}`})}}});var Nee=b(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.SDK_METADATA=Zh.ServerList=Zh.ServerEu=void 0;Zh.serverURLFromOptions=oqr;var nqr=Vn();Zh.ServerEu="eu";Zh.ServerList={[Zh.ServerEu]:"https://api.mistral.ai"};function oqr(t){let e=t.serverURL,r={};if(!e){let o=t.server??Zh.ServerEu;e=Zh.ServerList[o]||""}let n=(0,nqr.pathToFunc)(e)(r);return new URL(n)}Zh.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 HCe=b(zCe=>{"use strict";Object.defineProperty(zCe,"__esModule",{value:!0});zCe.readableStreamToArrayBuffer=iqr;async function iqr(t){let e=t.getReader(),r=[],n=0,o=!1;for(;!o;){let{value:s,done:u}=await e.read();u?o=!0:(r.push(s),n+=s.length)}let i=new Uint8Array(n),a=0;for(let s of r)i.set(s,a),a+=s.length;return i.buffer}});var z0t=b(Lee=>{"use strict";Object.defineProperty(Lee,"__esModule",{value:!0});Lee.CustomUserAgentHook=void 0;var aqr=Nee(),VCe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${aqr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Lee.CustomUserAgentHook=VCe});var V0t=b(Fee=>{"use strict";Object.defineProperty(Fee,"__esModule",{value:!0});Fee.DeprecationWarningHook=void 0;var H0t="x-model-deprecation-timestamp",WCe=class{afterSuccess(e,r){return r.headers.has(H0t)&&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(H0t)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Fee.DeprecationWarningHook=WCe});var W0t=b(JCe=>{"use strict";Object.defineProperty(JCe,"__esModule",{value:!0});JCe.initHooks=lqr;var sqr=z0t(),uqr=V0t();function lqr(t){let e=new sqr.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new uqr.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var J0t=b(kee=>{"use strict";Object.defineProperty(kee,"__esModule",{value:!0});kee.SDKHooks=void 0;var cqr=W0t(),GCe=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let r of e)"sdkInit"in r&&this.registerSDKInitHook(r),"beforeCreateRequest"in r&&this.registerBeforeCreateRequestHook(r),"beforeRequest"in r&&this.registerBeforeRequestHook(r),"afterSuccess"in r&&this.registerAfterSuccessHook(r),"afterError"in r&&this.registerAfterErrorHook(r);(0,cqr.initHooks)(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((r,n)=>n.sdkInit(r),e)}beforeCreateRequest(e,r){let n=r;for(let o of this.beforeCreateRequestHooks)n=o.beforeCreateRequest(e,n);return n}async beforeRequest(e,r){let n=r;for(let o of this.beforeRequestHooks)n=await o.beforeRequest(e,n);return n}async afterSuccess(e,r){let n=r;for(let o of this.afterSuccessHooks)n=await o.afterSuccess(e,n);return n}async afterError(e,r,n){let o=r,i=n;for(let a of this.afterErrorHooks){let s=await a.afterError(e,o,i);o=s.response,i=s.error}return{response:o,error:i}}};kee.SDKHooks=GCe});var eOe=b(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.ConnectionError=Uf.RequestTimeoutError=Uf.RequestAbortedError=Uf.InvalidRequestError=Uf.UnexpectedClientError=Uf.HTTPClientError=void 0;var xT=class extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=r?.cause)}};Uf.HTTPClientError=xT;var KCe=class extends xT{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Uf.UnexpectedClientError=KCe;var YCe=class extends xT{constructor(){super(...arguments),this.name="InvalidRequestError"}};Uf.InvalidRequestError=YCe;var XCe=class extends xT{constructor(){super(...arguments),this.name="RequestAbortedError"}};Uf.RequestAbortedError=XCe;var ZCe=class extends xT{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Uf.RequestTimeoutError=ZCe;var QCe=class extends xT{constructor(){super(...arguments),this.name="ConnectionError"}};Uf.ConnectionError=QCe});var Qh=b(SB=>{"use strict";Object.defineProperty(SB,"__esModule",{value:!0});SB.OK=dqr;SB.ERR=fqr;SB.unwrap=pqr;SB.unwrapAsync=hqr;function dqr(t){return{ok:!0,value:t}}function fqr(t){return{ok:!1,error:t}}function pqr(t){if(!t.ok)throw t.error;return t.value}async function hqr(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var n8=b(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.getParsedType=di.ZodParsedType=di.objectUtil=di.util=void 0;var tOe;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(tOe||(di.util=tOe={}));var G0t;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(G0t||(di.objectUtil=G0t={}));di.ZodParsedType=tOe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var mqr=t=>{switch(typeof t){case"undefined":return di.ZodParsedType.undefined;case"string":return di.ZodParsedType.string;case"number":return isNaN(t)?di.ZodParsedType.nan:di.ZodParsedType.number;case"boolean":return di.ZodParsedType.boolean;case"function":return di.ZodParsedType.function;case"bigint":return di.ZodParsedType.bigint;case"symbol":return di.ZodParsedType.symbol;case"object":return Array.isArray(t)?di.ZodParsedType.array:t===null?di.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?di.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?di.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?di.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?di.ZodParsedType.date:di.ZodParsedType.object;default:return di.ZodParsedType.unknown}};di.getParsedType=mqr});var Bee=b(CT=>{"use strict";Object.defineProperty(CT,"__esModule",{value:!0});CT.ZodError=CT.quotelessJson=CT.ZodIssueCode=void 0;var K0t=n8();CT.ZodIssueCode=K0t.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=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");CT.quotelessJson=gqr;var F1=class extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof F1))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,K0t.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};CT.ZodError=F1;F1.create=t=>new F1(t)});var nOe=b(rOe=>{"use strict";Object.defineProperty(rOe,"__esModule",{value:!0});var k1=n8(),ld=Bee(),yqr=(t,e)=>{let r;switch(t.code){case ld.ZodIssueCode.invalid_type:t.received===k1.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ld.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,k1.util.jsonStringifyReplacer)}`;break;case ld.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${k1.util.joinValues(t.keys,", ")}`;break;case ld.ZodIssueCode.invalid_union:r="Invalid input";break;case ld.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${k1.util.joinValues(t.options)}`;break;case ld.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${k1.util.joinValues(t.options)}, received '${t.received}'`;break;case ld.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ld.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ld.ZodIssueCode.invalid_date:r="Invalid date";break;case ld.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:k1.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ld.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ld.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ld.ZodIssueCode.custom:r="Invalid input";break;case ld.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ld.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ld.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,k1.util.assertNever(t)}return{message:r}};rOe.default=yqr});var $ee=b(sS=>{"use strict";var bqr=sS&&sS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sS,"__esModule",{value:!0});sS.getErrorMap=sS.setErrorMap=sS.defaultErrorMap=void 0;var Y0t=bqr(nOe());sS.defaultErrorMap=Y0t.default;var X0t=Y0t.default;function _qr(t){X0t=t}sS.setErrorMap=_qr;function vqr(){return X0t}sS.getErrorMap=vqr});var oOe=b(Io=>{"use strict";var wqr=Io&&Io.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Io,"__esModule",{value:!0});Io.isAsync=Io.isValid=Io.isDirty=Io.isAborted=Io.OK=Io.DIRTY=Io.INVALID=Io.ParseStatus=Io.addIssueToContext=Io.EMPTY_PATH=Io.makeIssue=void 0;var Sqr=$ee(),Z0t=wqr(nOe()),xqr=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};Io.makeIssue=xqr;Io.EMPTY_PATH=[];function Cqr(t,e){let r=(0,Sqr.getErrorMap)(),n=(0,Io.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Z0t.default?void 0:Z0t.default].filter(o=>!!o)});t.common.issues.push(n)}Io.addIssueToContext=Cqr;var o8=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Io.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return o8.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Io.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}};Io.ParseStatus=o8;Io.INVALID=Object.freeze({status:"aborted"});var Oqr=t=>({status:"dirty",value:t});Io.DIRTY=Oqr;var Eqr=t=>({status:"valid",value:t});Io.OK=Eqr;var Pqr=t=>t.status==="aborted";Io.isAborted=Pqr;var Tqr=t=>t.status==="dirty";Io.isDirty=Tqr;var Mqr=t=>t.status==="valid";Io.isValid=Mqr;var Aqr=t=>typeof Promise<"u"&&t instanceof Promise;Io.isAsync=Aqr});var ewt=b(Q0t=>{"use strict";Object.defineProperty(Q0t,"__esModule",{value:!0})});var rwt=b(qee=>{"use strict";Object.defineProperty(qee,"__esModule",{value:!0});qee.errorUtil=void 0;var twt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(twt||(qee.errorUtil=twt={}))});var hwt=b(K=>{"use strict";var zee=K&&K.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},owt=K&&K.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},i8,a8;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 Uee=$ee(),wt=rwt(),X=oOe(),Be=n8(),De=Bee(),tm=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},nwt=(t,e)=>{if((0,X.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new De.ZodError(t.common.issues);return this._error=r,this._error}}};function Sr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}var xr=class{get description(){return this._def.description}_getType(e){return(0,Be.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,Be.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,Be.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,X.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Be.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return nwt(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Be.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,X.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,X.isValid)(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Be.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,X.isAsync)(o)?o:Promise.resolve(o));return nwt(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:De.ZodIssueCode.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Bp({schema:this,typeName:Ht.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return em.create(this,this._def)}nullable(){return dS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kp.create(this)}promise(){return PT.create(this,this._def)}or(e){return U1.create([this,e],this._def)}and(e){return z1.create(this,e,this._def)}transform(e){return new Bp({...Sr(this._def),schema:this,typeName:Ht.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new G1({...Sr(this._def),innerType:this,defaultValue:r,typeName:Ht.ZodDefault})}brand(){return new s8({typeName:Ht.ZodBranded,type:this,...Sr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new K1({...Sr(this._def),innerType:this,catchValue:r,typeName:Ht.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Y1.create(this,e)}readonly(){return X1.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 Rqr=/^c[^\s-]{8,}$/i,Iqr=/^[0-9a-z]+$/,Dqr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jqr=/^[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,Nqr=/^[a-z0-9_-]{21}$/i,Lqr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fqr=/^[-+]?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)?)??$/,kqr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bqr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",iOe,$qr=/^(?:(?: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])$/,qqr=/^(?:(?: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])$/,Uqr=/^(([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]))$/,zqr=/^(([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])$/,Hqr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vqr=/^([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])))",Wqr=new RegExp(`^${iwt}$`);function awt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Jqr(t){return new RegExp(`^${awt(t)}$`)}function swt(t){let e=`${iwt}T${awt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}K.datetimeRegex=swt;function Gqr(t,e){return!!((e==="v4"||!e)&&$qr.test(t)||(e==="v6"||!e)&&Uqr.test(t))}function Kqr(t,e){if(!Lqr.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function Yqr(t,e){return!!((e==="v4"||!e)&&qqr.test(t)||(e==="v6"||!e)&&zqr.test(t))}var Fp=class extends xr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(i,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.string,received:i.parsedType}),X.INVALID}let n=new X.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")kqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"email",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")iOe||(iOe=new RegExp(Bqr,"u")),iOe.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"emoji",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")jqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"uuid",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Nqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"nanoid",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Rqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"cuid",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Iqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"cuid2",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Dqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"ulid",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"url",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"regex",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?swt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Wqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Jqr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Fqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"duration",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Gqr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"ip",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Kqr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"jwt",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Yqr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"cidr",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Hqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"base64",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Vqr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{validation:"base64url",code:De.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):Be.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:De.ZodIssueCode.invalid_string,...wt.errorUtil.errToObj(n)})}_addCheck(e){return new Fp({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...wt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...wt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...wt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...wt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...wt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...wt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...wt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...wt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...wt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...wt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...wt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...wt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...wt.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...wt.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...wt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...wt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...wt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...wt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...wt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...wt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...wt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...wt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...wt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,wt.errorUtil.errToObj(e))}trim(){return new Fp({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fp({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fp({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};K.ZodString=Fp;Fp.create=t=>{var e;return new Fp({checks:[],typeName:Ht.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Sr(t)})};function Xqr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var uS=class extends xr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Be.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(i,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.number,received:i.parsedType}),X.INVALID}let n,o=new X.ParseStatus;for(let i of this._def.checks)i.kind==="int"?Be.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Xqr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.not_finite,message:i.message}),o.dirty()):Be.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,wt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,wt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,wt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,wt.errorUtil.toString(r))}setLimit(e,r,n,o){return new uS({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:wt.errorUtil.toString(o)}]})}_addCheck(e){return new uS({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:wt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:wt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:wt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wt.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Be.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};K.ZodNumber=uS;uS.create=t=>new uS({checks:[],typeName:Ht.ZodNumber,coerce:t?.coerce||!1,...Sr(t)});var lS=class extends xr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Be.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new X.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Be.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.bigint,received:r.parsedType}),X.INVALID}gte(e,r){return this.setLimit("min",e,!0,wt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,wt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,wt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,wt.errorUtil.toString(r))}setLimit(e,r,n,o){return new lS({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:wt.errorUtil.toString(o)}]})}_addCheck(e){return new lS({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:wt.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};K.ZodBigInt=lS;lS.create=t=>{var e;return new lS({checks:[],typeName:Ht.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Sr(t)})};var B1=class extends xr{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Be.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.boolean,received:n.parsedType}),X.INVALID}return(0,X.OK)(e.data)}};K.ZodBoolean=B1;B1.create=t=>new B1({typeName:Ht.ZodBoolean,coerce:t?.coerce||!1,...Sr(t)});var MC=class extends xr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(i,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.date,received:i.parsedType}),X.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(i,{code:De.ZodIssueCode.invalid_date}),X.INVALID}let n=new X.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,X.addIssueToContext)(o,{code:De.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Be.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new MC({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:wt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:wt.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};K.ZodDate=MC;MC.create=t=>new MC({checks:[],coerce:t?.coerce||!1,typeName:Ht.ZodDate,...Sr(t)});var CB=class extends xr{_parse(e){if(this._getType(e)!==Be.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.symbol,received:n.parsedType}),X.INVALID}return(0,X.OK)(e.data)}};K.ZodSymbol=CB;CB.create=t=>new CB({typeName:Ht.ZodSymbol,...Sr(t)});var $1=class extends xr{_parse(e){if(this._getType(e)!==Be.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.undefined,received:n.parsedType}),X.INVALID}return(0,X.OK)(e.data)}};K.ZodUndefined=$1;$1.create=t=>new $1({typeName:Ht.ZodUndefined,...Sr(t)});var q1=class extends xr{_parse(e){if(this._getType(e)!==Be.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.null,received:n.parsedType}),X.INVALID}return(0,X.OK)(e.data)}};K.ZodNull=q1;q1.create=t=>new q1({typeName:Ht.ZodNull,...Sr(t)});var ET=class extends xr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,X.OK)(e.data)}};K.ZodAny=ET;ET.create=t=>new ET({typeName:Ht.ZodAny,...Sr(t)});var TC=class extends xr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,X.OK)(e.data)}};K.ZodUnknown=TC;TC.create=t=>new TC({typeName:Ht.ZodUnknown,...Sr(t)});var Ug=class extends xr{_parse(e){let r=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.never,received:r.parsedType}),X.INVALID}};K.ZodNever=Ug;Ug.create=t=>new Ug({typeName:Ht.ZodNever,...Sr(t)});var OB=class extends xr{_parse(e){if(this._getType(e)!==Be.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.void,received:n.parsedType}),X.INVALID}return(0,X.OK)(e.data)}};K.ZodVoid=OB;OB.create=t=>new OB({typeName:Ht.ZodVoid,...Sr(t)});var kp=class extends xr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Be.ZodParsedType.array)return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.array,received:r.parsedType}),X.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,X.addIssueToContext)(r,{code:a?De.ZodIssueCode.too_big:De.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,X.addIssueToContext)(r,{code:De.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,X.addIssueToContext)(r,{code:De.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 tm(r,a,r.path,s)))).then(a=>X.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new tm(r,a,r.path,s)));return X.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new kp({...this._def,minLength:{value:e,message:wt.errorUtil.toString(r)}})}max(e,r){return new kp({...this._def,maxLength:{value:e,message:wt.errorUtil.toString(r)}})}length(e,r){return new kp({...this._def,exactLength:{value:e,message:wt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};K.ZodArray=kp;kp.create=(t,e)=>new kp({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ht.ZodArray,...Sr(e)});function xB(t){if(t instanceof Mi){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=em.create(xB(n))}return new Mi({...t._def,shape:()=>e})}else return t instanceof kp?new kp({...t._def,type:xB(t.element)}):t instanceof em?em.create(xB(t.unwrap())):t instanceof dS?dS.create(xB(t.unwrap())):t instanceof rm?rm.create(t.items.map(e=>xB(e))):t}var Mi=class extends xr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Be.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Be.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(l,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.object,received:l.parsedType}),X.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ug&&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 tm(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Ug){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,X.addIssueToContext)(o,{code:De.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 tm(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=>X.ParseStatus.mergeObjectSync(n,l)):X.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return wt.errorUtil.errToObj,new Mi({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=wt.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new Mi({...this._def,unknownKeys:"strip"})}passthrough(){return new Mi({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mi({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mi({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ht.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Mi({...this._def,catchall:e})}pick(e){let r={};return Be.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Mi({...this._def,shape:()=>r})}omit(e){let r={};return Be.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Mi({...this._def,shape:()=>r})}deepPartial(){return xB(this)}partial(e){let r={};return Be.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new Mi({...this._def,shape:()=>r})}required(e){let r={};return Be.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof em;)i=i._def.innerType;r[n]=i}}),new Mi({...this._def,shape:()=>r})}keyof(){return uwt(Be.util.objectKeys(this.shape))}};K.ZodObject=Mi;Mi.create=(t,e)=>new Mi({shape:()=>t,unknownKeys:"strip",catchall:Ug.create(),typeName:Ht.ZodObject,...Sr(e)});Mi.strictCreate=(t,e)=>new Mi({shape:()=>t,unknownKeys:"strict",catchall:Ug.create(),typeName:Ht.ZodObject,...Sr(e)});Mi.lazycreate=(t,e)=>new Mi({shape:t,unknownKeys:"strip",catchall:Ug.create(),typeName:Ht.ZodObject,...Sr(e)});var U1=class extends xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new De.ZodError(s.ctx.common.issues));return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_union,unionErrors:a}),X.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 De.ZodError(u));return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_union,unionErrors:s}),X.INVALID}}get options(){return this._def.options}};K.ZodUnion=U1;U1.create=(t,e)=>new U1({options:t,typeName:Ht.ZodUnion,...Sr(e)});var PC=t=>t instanceof V1?PC(t.schema):t instanceof Bp?PC(t.innerType()):t instanceof W1?[t.value]:t instanceof cS?t.options:t instanceof J1?Be.util.objectValues(t.enum):t instanceof G1?PC(t._def.innerType):t instanceof $1?[void 0]:t instanceof q1?[null]:t instanceof em?[void 0,...PC(t.unwrap())]:t instanceof dS?[null,...PC(t.unwrap())]:t instanceof s8||t instanceof X1?PC(t.unwrap()):t instanceof K1?PC(t._def.innerType):[],EB=class extends xr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.ZodParsedType.object)return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.object,received:r.parsedType}),X.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,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=PC(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new EB({typeName:Ht.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Sr(n)})}};K.ZodDiscriminatedUnion=EB;function aOe(t,e){let r=(0,Be.getParsedType)(t),n=(0,Be.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===Be.ZodParsedType.object&&n===Be.ZodParsedType.object){let o=Be.util.objectKeys(e),i=Be.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=aOe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===Be.ZodParsedType.array&&n===Be.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=aOe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Be.ZodParsedType.date&&n===Be.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var z1=class extends xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,X.isAborted)(i)||(0,X.isAborted)(a))return X.INVALID;let s=aOe(i.value,a.value);return s.valid?(((0,X.isDirty)(i)||(0,X.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_intersection_types}),X.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=z1;z1.create=(t,e,r)=>new z1({left:t,right:e,typeName:Ht.ZodIntersection,...Sr(r)});var rm=class extends xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Be.ZodParsedType.array)return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.array,received:n.parsedType}),X.INVALID;if(n.data.length<this._def.items.length)return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,X.addIssueToContext)(n,{code:De.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 tm(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>X.ParseStatus.mergeArray(r,a)):X.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new rm({...this._def,rest:e})}};K.ZodTuple=rm;rm.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rm({items:t,typeName:Ht.ZodTuple,rest:null,...Sr(e)})};var H1=class extends xr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Be.ZodParsedType.object)return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.object,received:n.parsedType}),X.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new tm(n,s,n.path,s)),value:a._parse(new tm(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?X.ParseStatus.mergeObjectAsync(r,o):X.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof xr?new H1({keyType:e,valueType:r,typeName:Ht.ZodRecord,...Sr(n)}):new H1({keyType:Fp.create(),valueType:e,typeName:Ht.ZodRecord,...Sr(r)})}};K.ZodRecord=H1;var PB=class extends xr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Be.ZodParsedType.map)return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.map,received:n.parsedType}),X.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new tm(n,s,n.path,[l,"key"])),value:i._parse(new tm(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 X.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 X.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};K.ZodMap=PB;PB.create=(t,e,r)=>new PB({valueType:e,keyType:t,typeName:Ht.ZodMap,...Sr(r)});var AC=class extends xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Be.ZodParsedType.set)return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.set,received:n.parsedType}),X.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,X.addIssueToContext)(n,{code:De.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,X.addIssueToContext)(n,{code:De.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 X.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 tm(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new AC({...this._def,minSize:{value:e,message:wt.errorUtil.toString(r)}})}max(e,r){return new AC({...this._def,maxSize:{value:e,message:wt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};K.ZodSet=AC;AC.create=(t,e)=>new AC({valueType:t,minSize:null,maxSize:null,typeName:Ht.ZodSet,...Sr(e)});var OT=class extends xr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.ZodParsedType.function)return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.function,received:r.parsedType}),X.INVALID;function n(s,u){return(0,X.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uee.getErrorMap)(),Uee.defaultErrorMap].filter(l=>!!l),issueData:{code:De.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,X.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uee.getErrorMap)(),Uee.defaultErrorMap].filter(l=>!!l),issueData:{code:De.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof PT){let s=this;return(0,X.OK)(async function(...u){let l=new De.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,X.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new De.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 De.ZodError([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new OT({...this._def,args:rm.create(e).rest(TC.create())})}returns(e){return new OT({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new OT({args:e||rm.create([]).rest(TC.create()),returns:r||TC.create(),typeName:Ht.ZodFunction,...Sr(n)})}};K.ZodFunction=OT;var V1=class extends xr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};K.ZodLazy=V1;V1.create=(t,e)=>new V1({getter:t,typeName:Ht.ZodLazy,...Sr(e)});var W1=class extends xr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(r,{received:r.data,code:De.ZodIssueCode.invalid_literal,expected:this._def.value}),X.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};K.ZodLiteral=W1;W1.create=(t,e)=>new W1({value:t,typeName:Ht.ZodLiteral,...Sr(e)});function uwt(t,e){return new cS({values:t,typeName:Ht.ZodEnum,...Sr(e)})}var cS=class extends xr{constructor(){super(...arguments),i8.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,X.addIssueToContext)(r,{expected:Be.util.joinValues(n),received:r.parsedType,code:De.ZodIssueCode.invalid_type}),X.INVALID}if(zee(this,i8,"f")||owt(this,i8,new Set(this._def.values),"f"),!zee(this,i8,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,X.addIssueToContext)(r,{received:r.data,code:De.ZodIssueCode.invalid_enum_value,options:n}),X.INVALID}return(0,X.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return cS.create(e,{...this._def,...r})}exclude(e,r=this._def){return cS.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};K.ZodEnum=cS;i8=new WeakMap;cS.create=uwt;var J1=class extends xr{constructor(){super(...arguments),a8.set(this,void 0)}_parse(e){let r=Be.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Be.ZodParsedType.string&&n.parsedType!==Be.ZodParsedType.number){let o=Be.util.objectValues(r);return(0,X.addIssueToContext)(n,{expected:Be.util.joinValues(o),received:n.parsedType,code:De.ZodIssueCode.invalid_type}),X.INVALID}if(zee(this,a8,"f")||owt(this,a8,new Set(Be.util.getValidEnumValues(this._def.values)),"f"),!zee(this,a8,"f").has(e.data)){let o=Be.util.objectValues(r);return(0,X.addIssueToContext)(n,{received:n.data,code:De.ZodIssueCode.invalid_enum_value,options:o}),X.INVALID}return(0,X.OK)(e.data)}get enum(){return this._def.values}};K.ZodNativeEnum=J1;a8=new WeakMap;J1.create=(t,e)=>new J1({values:t,typeName:Ht.ZodNativeEnum,...Sr(e)});var PT=class extends xr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.ZodParsedType.promise&&r.common.async===!1)return(0,X.addIssueToContext)(r,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.promise,received:r.parsedType}),X.INVALID;let n=r.parsedType===Be.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,X.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};K.ZodPromise=PT;PT.create=(t,e)=>new PT({type:t,typeName:Ht.ZodPromise,...Sr(e)});var Bp=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(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{(0,X.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 X.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?X.INVALID:u.status==="dirty"||r.value==="dirty"?(0,X.DIRTY)(u.value):u});{if(r.value==="aborted")return X.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?X.INVALID:s.status==="dirty"||r.value==="dirty"?(0,X.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"?X.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"?X.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,X.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,X.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Be.util.assertNever(o)}};K.ZodEffects=Bp;K.ZodTransformer=Bp;Bp.create=(t,e,r)=>new Bp({schema:t,typeName:Ht.ZodEffects,effect:e,...Sr(r)});Bp.createWithPreprocess=(t,e,r)=>new Bp({schema:e,effect:{type:"preprocess",transform:t},typeName:Ht.ZodEffects,...Sr(r)});var em=class extends xr{_parse(e){return this._getType(e)===Be.ZodParsedType.undefined?(0,X.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};K.ZodOptional=em;em.create=(t,e)=>new em({innerType:t,typeName:Ht.ZodOptional,...Sr(e)});var dS=class extends xr{_parse(e){return this._getType(e)===Be.ZodParsedType.null?(0,X.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};K.ZodNullable=dS;dS.create=(t,e)=>new dS({innerType:t,typeName:Ht.ZodNullable,...Sr(e)});var G1=class extends xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Be.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};K.ZodDefault=G1;G1.create=(t,e)=>new G1({innerType:t,typeName:Ht.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Sr(e)});var K1=class extends xr{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,X.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new De.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new De.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};K.ZodCatch=K1;K1.create=(t,e)=>new K1({innerType:t,typeName:Ht.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Sr(e)});var TB=class extends xr{_parse(e){if(this._getType(e)!==Be.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,X.addIssueToContext)(n,{code:De.ZodIssueCode.invalid_type,expected:Be.ZodParsedType.nan,received:n.parsedType}),X.INVALID}return{status:"valid",value:e.data}}};K.ZodNaN=TB;TB.create=t=>new TB({typeName:Ht.ZodNaN,...Sr(t)});K.BRAND=Symbol("zod_brand");var s8=class extends xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};K.ZodBranded=s8;var Y1=class extends xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?X.INVALID:i.status==="dirty"?(r.dirty(),(0,X.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"?X.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new Y1({in:e,out:r,typeName:Ht.ZodPipeline})}};K.ZodPipeline=Y1;var X1=class extends xr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,X.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,X.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};K.ZodReadonly=X1;X1.create=(t,e)=>new X1({innerType:t,typeName:Ht.ZodReadonly,...Sr(e)});function lwt(t,e={},r){return t?ET.create().superRefine((n,o)=>{var i,a;if(!t(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,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})}}):ET.create()}K.custom=lwt;K.late={object:Mi.lazycreate};var Ht;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ht||(K.ZodFirstPartyTypeKind=Ht={}));var Zqr=(t,e={message:`Input not instance of ${t.name}`})=>lwt(r=>r instanceof t,e);K.instanceof=Zqr;var cwt=Fp.create;K.string=cwt;var dwt=uS.create;K.number=dwt;var Qqr=TB.create;K.nan=Qqr;var eUr=lS.create;K.bigint=eUr;var fwt=B1.create;K.boolean=fwt;var tUr=MC.create;K.date=tUr;var rUr=CB.create;K.symbol=rUr;var nUr=$1.create;K.undefined=nUr;var oUr=q1.create;K.null=oUr;var iUr=ET.create;K.any=iUr;var aUr=TC.create;K.unknown=aUr;var sUr=Ug.create;K.never=sUr;var uUr=OB.create;K.void=uUr;var lUr=kp.create;K.array=lUr;var cUr=Mi.create;K.object=cUr;var dUr=Mi.strictCreate;K.strictObject=dUr;var fUr=U1.create;K.union=fUr;var pUr=EB.create;K.discriminatedUnion=pUr;var hUr=z1.create;K.intersection=hUr;var mUr=rm.create;K.tuple=mUr;var gUr=H1.create;K.record=gUr;var yUr=PB.create;K.map=yUr;var bUr=AC.create;K.set=bUr;var _Ur=OT.create;K.function=_Ur;var vUr=V1.create;K.lazy=vUr;var wUr=W1.create;K.literal=wUr;var SUr=cS.create;K.enum=SUr;var xUr=J1.create;K.nativeEnum=xUr;var CUr=PT.create;K.promise=CUr;var pwt=Bp.create;K.effect=pwt;K.transformer=pwt;var OUr=em.create;K.optional=OUr;var EUr=dS.create;K.nullable=EUr;var PUr=Bp.createWithPreprocess;K.preprocess=PUr;var TUr=Y1.create;K.pipeline=TUr;var MUr=()=>cwt().optional();K.ostring=MUr;var AUr=()=>dwt().optional();K.onumber=AUr;var RUr=()=>fwt().optional();K.oboolean=RUr;K.coerce={string:t=>Fp.create({...t,coerce:!0}),number:t=>uS.create({...t,coerce:!0}),boolean:t=>B1.create({...t,coerce:!0}),bigint:t=>lS.create({...t,coerce:!0}),date:t=>MC.create({...t,coerce:!0})};K.NEVER=X.INVALID});var sOe=b(nm=>{"use strict";var IUr=nm&&nm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MB=nm&&nm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&IUr(e,t,r)};Object.defineProperty(nm,"__esModule",{value:!0});MB($ee(),nm);MB(oOe(),nm);MB(ewt(),nm);MB(n8(),nm);MB(hwt(),nm);MB(Bee(),nm)});var ge=b(zf=>{"use strict";var mwt=zf&&zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DUr=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jUr=zf&&zf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mwt(e,t,r);return DUr(e,t),e},NUr=zf&&zf.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mwt(e,t,r)};Object.defineProperty(zf,"__esModule",{value:!0});zf.z=void 0;var gwt=jUr(sOe());zf.z=gwt;NUr(sOe(),zf);zf.default=gwt});var cOe=b(Nl=>{"use strict";var LUr=Nl&&Nl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FUr=Nl&&Nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kUr=Nl&&Nl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LUr(e,t,r);return FUr(e,t),e};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.zodInbound=Nl.zodOutbound=void 0;Nl.bytesToBase64=ywt;Nl.bytesFromBase64=uOe;Nl.stringToBytes=lOe;Nl.stringFromBytes=bwt;Nl.stringToBase64=BUr;Nl.stringFromBase64=$Ur;var Hee=kUr(ge());function ywt(t){return btoa(String.fromCodePoint(...t))}function uOe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function lOe(t){return new TextEncoder().encode(t)}function bwt(t){return new TextDecoder().decode(t)}function BUr(t){return ywt(lOe(t))}function $Ur(t){return bwt(uOe(t))}Nl.zodOutbound=Hee.instanceof(Uint8Array).or(Hee.string().transform(lOe));Nl.zodInbound=Hee.instanceof(Uint8Array).or(Hee.string().transform(uOe))});var fOe=b(dOe=>{"use strict";Object.defineProperty(dOe,"__esModule",{value:!0});dOe.isPlainObject=qUr;function qUr(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}});var wo=b(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.encodeDeepObjectQuery=Pn.encodePipeDelimitedQuery=Pn.encodeSpaceDelimitedQuery=Pn.encodeFormQuery=Pn.encodeJSONQuery=Pn.encodeSimple=Pn.encodePipeDelimited=Pn.encodeSpaceDelimited=Pn.encodeForm=Pn.EncodingError=void 0;Pn.encodeMatrix=UUr;Pn.encodeLabel=zUr;Pn.encodeBodyForm=HUr;Pn.encodeDeepObject=vwt;Pn.encodeDeepObjectObject=hOe;Pn.encodeJSON=wwt;Pn.queryJoin=Swt;Pn.queryEncoder=RB;Pn.appendForm=WUr;var _wt=cOe(),zg=fOe(),u8=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Pn.EncodingError=u8;function UUr(t,e,r){let n="",o=r?.explode?l8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(AB(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=c8(u,f=>`${a(f)}`)?.join(","):(0,zg.isPlainObject)(u)?c=Wee(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 zUr(t,e,r){let n="",o=r?.explode?l8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(AB(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=c8(u,c=>`${a(c)}`)?.join("."):(0,zg.isPlainObject)(u)?l=Wee(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,zg.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function pOe(t){return(e,r,n)=>{let o="",i=n?.explode?l8(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(AB(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=c8(c,p=>`${s(p)}`)?.join(u):(0,zg.isPlainObject)(c)?f=Wee(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)}}Pn.encodeForm=pOe(",");Pn.encodeSpaceDelimited=pOe(" ");Pn.encodePipeDelimited=pOe("|");function HUr(t,e,r){let n="",o=r?.explode?l8(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(AB(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,zg.isPlainObject)(u)?c=JSON.stringify(u,Vee):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function vwt(t,e,r){if(e!=null){if(!(0,zg.isPlainObject)(e))throw new u8(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return hOe(t,e,r)}}function hOe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,zg.isPlainObject)(e))throw new u8(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,zg.isPlainObject)(a)){let c=hOe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=c8(u,c=>`${o(s)}=${o(AB(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function wwt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,Vee));return r?.explode?o:`${n(t)}=${o}`}var VUr=(t,e,r)=>{let n="",o=r?.explode?l8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(AB(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=c8(u,c=>`${a(c)}`)?.join(","):(0,zg.isPlainObject)(u)?l=Wee(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,zg.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Pn.encodeSimple=VUr;function l8(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,zg.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function AB(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,_wt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,Vee):`${t}`}function Vee(t,e){return e instanceof Uint8Array?(0,_wt.bytesToBase64)(e):e}function c8(t,e){let r=t.reduce((n,o)=>{if(o==null)return n;let i=e(o);return i==null||n.push(i),n},[]);return r.length?r:null}function Wee(t,e){let r=[];for(let[n,o]of t){if(o==null)continue;let i=e([n,o]);i!=null&&r.push(i)}return r.length?r:null}function Swt(...t){return t.filter(Boolean).join("&")}function RB(t){return function(r,n){let o={...n,explode:n?.explode??!0,charEncoding:n?.charEncoding??"percent"},i=Object.entries(r).map(([a,s])=>t(a,s,o));return Swt(...i)}}Pn.encodeJSONQuery=RB(wwt);Pn.encodeFormQuery=RB(Pn.encodeForm);Pn.encodeSpaceDelimitedQuery=RB(Pn.encodeSpaceDelimited);Pn.encodePipeDelimitedQuery=RB(Pn.encodePipeDelimited);Pn.encodeDeepObjectQuery=RB(vwt);function WUr(t,e,r,n){r!=null&&(r instanceof Blob&&n?t.append(e,r,n):r instanceof Blob?t.append(e,r):t.append(e,String(r)))}});var xwt=b(mOe=>{"use strict";Object.defineProperty(mOe,"__esModule",{value:!0});mOe.dlv=JUr;function JUr(t,e,r,n,o){for(e=Array.isArray(e)?e:e.split("."),n=0;n<e.length;n++){let i=e[n];t=i!=null&&t?t[i]:o}return t===o?r:t}});var yOe=b($p=>{"use strict";var GUr=$p&&$p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KUr=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YUr=$p&&$p.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GUr(e,t,r);return KUr(e,t),e};Object.defineProperty($p,"__esModule",{value:!0});$p.envSchema=void 0;$p.env=XUr;$p.resetEnv=ZUr;var Cwt=xwt(),gOe=YUr(ge());$p.envSchema=gOe.object({MISTRAL_API_KEY:gOe.string().optional(),MISTRAL_DEBUG:gOe.coerce.boolean().optional()});var d8;function XUr(){return d8||(d8=$p.envSchema.parse((0,Cwt.dlv)(globalThis,"process.env")??(0,Cwt.dlv)(globalThis,"Deno.env")??{}),d8)}function ZUr(){d8=void 0}});var p8=b(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.HTTPClient=void 0;fS.matchContentType=Ewt;fS.matchStatusCode=Pwt;fS.matchResponse=tzr;fS.isConnectionError=rzr;fS.isTimeoutError=nzr;fS.isAbortError=ozr;var QUr=(t,e)=>e==null?fetch(t):fetch(t,e),f8=class{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||QUr}async request(e){let r=e;for(let n of this.requestHooks){let o=await n(r);o&&(r=o)}try{let n=await this.fetcher(r);for(let o of this.responseHooks)await o(n,r);return n}catch(n){for(let o of this.requestErrorHooks)await o(n,r);throw n}}addHook(...e){if(e[0]==="beforeRequest")this.requestHooks.push(e[1]);else if(e[0]==="requestError")this.requestErrorHooks.push(e[1]);else if(e[0]==="response")this.responseHooks.push(e[1]);else throw new Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let r;if(e[0]==="beforeRequest")r=this.requestHooks;else if(e[0]==="requestError")r=this.requestErrorHooks;else if(e[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${e[0]}`);let n=r.findIndex(o=>o===e[1]);return n>=0&&r.splice(n,1),this}clone(){let e=new f8(this.options);return e.requestHooks=this.requestHooks.slice(),e.requestErrorHooks=this.requestErrorHooks.slice(),e.responseHooks=this.responseHooks.slice(),e}};fS.HTTPClient=f8;var Owt=/\s*;\s*/g;function Ewt(t,e){if(e==="*")return!0;let r=t.headers.get("content-type")?.trim()||"application/octet-stream";r=r.toLowerCase();let n=e.toLowerCase().trim().split(Owt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(Owt),[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 ezr=new RegExp("^[0-9]xx$","i");function Pwt(t,e){let r=`${t.status}`,n=Array.isArray(e)?e:[e];return n.length?n.some(o=>{let i=`${o}`;if(i==="default")return!0;if(!ezr.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 tzr(t,e,r){return Pwt(t,e)&&Ewt(t,r)}function rzr(t){if(typeof t!="object"||t==null)return!1;let e=t instanceof TypeError&&t.message.toLowerCase().startsWith("failed to fetch"),r=t instanceof TypeError&&t.message.toLowerCase().startsWith("fetch failed"),n="name"in t&&t.name==="ConnectionError",o="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnreset";return e||r||o||n}function nzr(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="TimeoutError",r="code"in t&&t.code===23,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}function ozr(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="AbortError",r="code"in t&&t.code===20,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}});var Mwt=b(Q1=>{"use strict";Object.defineProperty(Q1,"__esModule",{value:!0});Q1.TemporaryError=Q1.PermanentError=void 0;Q1.retry=azr;var Twt=p8(),izr={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},Z1=class extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,Z1.prototype)}};Q1.PermanentError=Z1;var RC=class extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,RC.prototype)}};Q1.TemporaryError=RC;async function azr(t,e){switch(e.config.strategy){case"backoff":return czr(szr(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??izr);default:return await t()}}function szr(t,e){return async()=>{try{let r=await t();if(lzr(r,e.statusCodes))throw new RC("Response failed with retryable status code",r);return r}catch(r){throw r instanceof RC||e.retryConnectionErrors&&((0,Twt.isTimeoutError)(r)||(0,Twt.isConnectionError)(r))?r:new Z1("Permanent error",{cause:r})}}}var uzr=new RegExp("^[0-9]xx$","i");function lzr(t,e){let r=`${t.status}`;return e.some(n=>{if(!uzr.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 czr(t,e){let{maxElapsedTime:r,initialInterval:n,exponent:o,maxInterval:i}=e,a=Date.now(),s=0;for(;;)try{return await t()}catch(u){if(u instanceof Z1)throw u.cause;if(Date.now()-a>r){if(u instanceof RC)return u.response;throw u}let c=0;u instanceof RC&&(c=dzr(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await fzr(d),s++}}function dzr(t){let e=t.headers.get("retry-after")||"";if(!e)return 0;let r=Number(e);if(Number.isInteger(r))return r*1e3;let n=Date.parse(e);if(Number.isInteger(n)){let o=n-Date.now();return o>0?Math.ceil(o):0}return 0}async function fzr(t){return new Promise(e=>setTimeout(e,t))}});var qp=b(MT=>{"use strict";var h8=MT&&MT.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},om=MT&&MT.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Gee,pS,IC;Object.defineProperty(MT,"__esModule",{value:!0});MT.ClientSDK=void 0;var Awt=J0t(),IB=eOe(),TT=Qh(),pzr=cOe(),Rwt=Nee(),hzr=wo(),mzr=yOe(),DC=p8(),gzr=Mwt(),Jee=typeof globalThis>"u"?null:globalThis,yzr=typeof Jee=="object"&&Jee!=null&&"importScripts"in Jee&&typeof Jee.importScripts=="function",bzr=yzr||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",bOe=class{constructor(e={}){Gee.set(this,void 0),pS.set(this,void 0),IC.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof Awt.SDKHooks?h8(this,pS,r.hooks,"f"):h8(this,pS,new Awt.SDKHooks,"f"),this._options={...e,hooks:om(this,pS,"f")};let n=(0,Rwt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=om(this,pS,"f").sdkInit({baseURL:n,client:e.httpClient||new DC.HTTPClient});this._baseURL=o,h8(this,Gee,i,"f"),h8(this,IC,e.debugLogger,"f"),!om(this,IC,"f")&&(0,mzr.env)().MISTRAL_DEBUG&&h8(this,IC,console,"f")}_createRequest(e,r,n){let{method:o,path:i,query:a,headers:s,security:u}=r,l=r.baseURL??this._baseURL;if(!l)return(0,TT.ERR)(new IB.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,hzr.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,v=u?.basic.password;if(m!=null||v!=null){let T=(0,pzr.stringToBase64)([m||"",v||""].join(":"));h.set("Authorization",`Basic ${T}`)}let g=new Headers(u?.headers||{});for(let[T,E]of g)h.set(T,E);let _=h.get("cookie")||"";for(let[T,E]of Object.entries(u?.cookies||{}))_+=`; ${T}=${E}`;_=_.startsWith("; ")?_.slice(2):_,h.set("cookie",_);let S=new Headers(n?.fetchOptions?.headers);for(let[T,E]of S)h.set(T,E);bzr||h.set(r.uaHeader??"user-agent",Rwt.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=om(this,pS,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:h,method:o}})}catch(T){return(0,TT.ERR)(new IB.UnexpectedClientError("Create request hook failed to execute",{cause:T}))}return(0,TT.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,gzr.retry)(async()=>{let i=await om(this,pS,"f").beforeRequest(n,e.clone());await _zr(om(this,IC,"f"),i).catch(s=>om(this,IC,"f")?.log("Failed to log request:",s));let a=await om(this,Gee,"f").request(i);try{if((0,DC.matchStatusCode)(a,o)){let s=await om(this,pS,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await om(this,pS,"f").afterSuccess(n,a)}finally{await vzr(om(this,IC,"f"),a,i).catch(s=>om(this,IC,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,TT.OK)(i),i=>{switch(!0){case(0,DC.isAbortError)(i):return(0,TT.ERR)(new IB.RequestAbortedError("Request aborted by client",{cause:i}));case(0,DC.isTimeoutError)(i):return(0,TT.ERR)(new IB.RequestTimeoutError("Request timed out",{cause:i}));case(0,DC.isConnectionError)(i):return(0,TT.ERR)(new IB.ConnectionError("Unable to make request",{cause:i}));default:return(0,TT.ERR)(new IB.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};MT.ClientSDK=bOe;Gee=new WeakMap,pS=new WeakMap,IC=new WeakMap;var Iwt=/^application\/(?:.{0,100}\+)?json/;async function _zr(t,e){if(!t)return;let r=e.headers.get("content-type"),n=r?.split(";")[0]||"";t.group(`> Request: ${e.method} ${e.url}`),t.group("Headers:");for(let[o,i]of e.headers.entries())t.log(`${o}: ${i}`);switch(t.groupEnd(),t.group("Body:"),!0){case Iwt.test(n):t.log(await e.clone().json());break;case n.startsWith("text/"):t.log(await e.clone().text());break;case n==="multipart/form-data":{let o=await e.clone().formData();for(let[i,a]of o){let s=a instanceof Blob?"<Blob>":a;t.log(`${i}: ${s}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function vzr(t,e,r){if(!t)return;let n=e.headers.get("content-type"),o=n?.split(";")[0]||"";t.group(`< Response: ${r.method} ${r.url}`),t.log("Status Code:",e.status,e.statusText),t.group("Headers:");for(let[i,a]of e.headers.entries())t.log(`${i}: ${a}`);switch(t.groupEnd(),t.group("Body:"),!0){case((0,DC.matchContentType)(e,"application/json")||Iwt.test(o)):t.log(await e.clone().json());break;case(0,DC.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,DC.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,DC.matchContentType)(e,"multipart/form-data"):{let i=await e.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"<Blob>":s;t.log(`${a}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}});var vOe=b(Kee=>{"use strict";Object.defineProperty(Kee,"__esModule",{value:!0});Kee.SDKError=void 0;var _Oe=class extends Error{constructor(e,r,n=""){let o=r.status,i=r.headers.get("content-type")||"",a=n.length>0?`
${n}`:"";super(`${e}: Status ${o} Content-Type ${i} Body ${a}`),this.rawResponse=r,this.body=n,this.statusCode=o,this.contentType=i,this.name="SDKError"}};Kee.SDKError=_Oe});var b8=b(y8=>{"use strict";Object.defineProperty(y8,"__esModule",{value:!0});y8.EventStream=void 0;y8.discardSentinel=xzr;var m8=10,g8=13,Dwt=new Set([m8,g8]),wzr=[new Uint8Array([g8,m8,g8,m8]),new Uint8Array([g8,g8]),new Uint8Array([m8,m8])],wOe=class{constructor(e){this.stream=e.stream,this.decoder=e.decoder}async*[Symbol.asyncIterator](){let e=this.stream.getReader(),r=new Uint8Array([]),n=0;try{for(;;){let{done:o,value:i}=await e.read();if(o)break;let a=new Uint8Array(r.length+i.length);a.set(r),a.set(i,r.length),r=a;for(let s=n;s<r.length;s++){let u=jwt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=SOe(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=SOe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};y8.EventStream=wOe;function jwt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!Dwt.has(r)||!Dwt.has(n))return null;for(let o of wzr){let i=Szr(e,t,o);if(i!=null)return i}return null}function Szr(t,e,r){if(r.length>e.length-t)return null;for(let n=0;n<r.length;n++)if(e[t+n]!==r[n])return null;return r}function SOe(t,e){if(!t.length)return null;let o=new TextDecoder().decode(t).split(/\r?\n|\r/g),i=!1,a={};for(let s of o){if(!s)continue;let u=s.indexOf(":");if(u===0)continue;let l=u>0?s.substring(0,u):"",c=u>0?s.substring(u+1):"";switch(c.charAt(0)===" "&&(c=c.substring(1)),l){case"event":{i=!0,a.event=c;break}case"data":{i=!0,a.data??(a.data=""),a.data+=c+`
`;break}case"id":{i=!0,a.id=c;break}case"retry":{let d=parseInt(c,10);Number.isNaN(d)||(i=!0,a.retry=d);break}}}return i?(a.data!=null&&(a.data=a.data.slice(0,-1)),e(a)):null}function xzr(t,e){return new ReadableStream({async start(r){let n=new Uint8Array([]),o=0,i=!1,a=!1,s=t.getReader();try{for(;!i;){let u=await s.read(),l=u.value;if(i=i||u.done,a||typeof l>"u")continue;let c=new Uint8Array(n.length+l.length);c.set(n),c.set(l,n.length),n=c;for(let d=o;d<n.length;d++){let f=jwt(n,d);if(f==null)continue;let p=o,h=n.slice(p,d);o=d+f.length,SOe(h,Czr)?.data===e?(r.enqueue(n.slice(0,p)),a=!0):(r.enqueue(n.slice(0,o)),n=n.slice(o),o=0)}}}catch(u){r.error(u)}finally{r.close(),s.releaseLock()}}})}function Czr(t){return t}});var OOe=b(Hg=>{"use strict";var Ozr=Hg&&Hg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ezr=Hg&&Hg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pzr=Hg&&Hg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ozr(e,t,r);return Ezr(e,t),e};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.SDKValidationError=void 0;Hg.formatZodError=COe;var Tzr=Pzr(ge()),xOe=class extends Error{constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof Tzr.ZodError?`${this.rawMessage}
${COe(this.cause)}`:this.toString()}};Hg.SDKValidationError=xOe;function COe(t,e=0){let r=" ".repeat(e);r=e>0?`\u2502${r}`:r,r+=" ".repeat(e);let n="",o=s=>n+=`
${r}${s}`,i=t.issues.length,a=i===1?`${i} issue found`:`${i} issues found`;i&&o(`\u250C ${a}:`);for(let s of t.issues){let u=s.path.join(".");switch(u=u?`<root>.${u}`:"<root>",o(`\u2502 \u2022 [${u}]: ${s.message} (${s.code})`),s.code){case"invalid_literal":case"invalid_type":{o(`\u2502 Want: ${s.expected}`),o(`\u2502 Got: ${s.received}`);break}case"unrecognized_keys":{o(`\u2502 Keys: ${s.keys.join(", ")}`);break}case"invalid_enum_value":{o(`\u2502 Allowed: ${s.options.join(", ")}`),o(`\u2502 Got: ${s.received}`);break}case"invalid_union_discriminator":{o(`\u2502 Allowed: ${s.options.join(", ")}`);break}case"invalid_union":{let l=s.unionErrors.length;o(`\u2502 \u2716\uFE0E Attemped to deserialize into one of ${l} union members:`),s.unionErrors.forEach((c,d)=>{o(`\u2502 \u2716\uFE0E Member ${d+1} of ${l}`),o(`${COe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var de=b(_8=>{"use strict";Object.defineProperty(_8,"__esModule",{value:!0});_8.parse=Azr;_8.safeParse=Rzr;_8.collectExtraKeys=Izr;var Mzr=ge(),Lwt=OOe(),Nwt=Qh();function Azr(t,e,r){try{return e(t)}catch(n){throw n instanceof Mzr.ZodError?new Lwt.SDKValidationError(r,n,t):n}}function Rzr(t,e,r){try{return(0,Nwt.OK)(e(t))}catch(n){return(0,Nwt.ERR)(new Lwt.SDKValidationError(r,n,t))}}function Izr(t,e,r){return t.transform(n=>{let o={},{shape:i}=t;for(let[a]of Object.entries(n)){if(a in i)continue;let s=n[a];typeof s>"u"||(o[a]=s,delete n[a])}return r&&Object.keys(o).length===0?n:{...n,[e]:o}})}});var So=b(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.jsonErr=Nzr;Ll.json=Lzr;Ll.textErr=Fzr;Ll.text=kzr;Ll.bytesErr=Bzr;Ll.bytes=$zr;Ll.streamErr=qzr;Ll.stream=Uzr;Ll.sseErr=zzr;Ll.sse=Hzr;Ll.nilErr=Vzr;Ll.nil=Wzr;Ll.fail=Jzr;Ll.match=Gzr;Ll.unpackHeaders=Yee;Ll.discardResponseBody=qwt;var Fwt=vOe(),Dzr=b8(),kwt=p8(),Bwt=fOe(),$wt=de(),jzr={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function Nzr(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function Lzr(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function Fzr(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function kzr(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function Bzr(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function $zr(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function qzr(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function Uzr(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function zzr(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function Hzr(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function Vzr(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function Wzr(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Jzr(t){return{enc:"fail",codes:t}}function Gzr(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:jzr[l.enc];if(d&&(0,kwt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,kwt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new Fwt.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,Dzr.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await qwt(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 Fwt.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:Yee(r.headers)}:null,...(0,Bwt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:Yee(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:Yee(r.headers)}:null,...(0,Bwt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,$wt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,$wt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var Kzr=/, */;function Yee(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Kzr);return e}async function qwt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ee=b(eD=>{"use strict";Object.defineProperty(eD,"__esModule",{value:!0});eD.invariant=Yzr;eD.remap=Xzr;eD.combineSignals=Zzr;eD.abortSignalAny=Uwt;eD.compactMap=Qzr;var EOe=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Yzr(t,e){if(!t)throw new EOe(e)}function Xzr(t,e){let r={};if(!Object.keys(e).length)return r=t,r;for(let[n,o]of Object.entries(t)){let i=e[n];i!==null&&(r[i??n]=o)}return r}function Zzr(...t){let e=[];for(let r of t)r&&e.push(r);switch(e.length){case 0:case 1:return e[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(e):Uwt(e)}}function Uwt(t){let e=new AbortController,r=e.signal;if(!t.length)return e.signal;if(t.length===1)return t[0]||e.signal;for(let a of t)if(a.aborted)return a;function n(){e.abort(this.reason),i()}let o=[];function i(){for(let a of o){let s=a.deref();s&&s.removeEventListener("abort",n)}}for(let a of t)o.push(new WeakRef(a)),a.addEventListener("abort",n);return r}function Qzr(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var xo=b(jC=>{"use strict";Object.defineProperty(jC,"__esModule",{value:!0});jC.SecurityError=jC.SecurityErrorCode=void 0;jC.resolveSecurity=zwt;jC.resolveGlobalSecurity=r2r;jC.extractSecurity=n2r;var e2r=yOe(),Zee;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(Zee||(jC.SecurityErrorCode=Zee={}));var tD=class extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new tD(Zee.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new tD(Zee.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};jC.SecurityError=tD;function zwt(...t){let e={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=t.find(n=>n.every(o=>{if(o.value==null)return!1;if(o.type==="http:basic")return o.value.username!=null||o.value.password!=null;if(o.type==="http:custom")return null;if(o.type==="oauth2:password")return typeof o.value=="string"&&!!o.value;if(o.type==="oauth2:client_credentials")return o.value.clientID!=null||o.value.clientSecret!=null;if(typeof o.value=="string")return!!o.value;throw new Error(`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`)}));return r==null?null:(r.forEach(n=>{if(n.value==null)return;let{type:o}=n;switch(o){case"apiKey:header":e.headers[n.fieldName]=n.value;break;case"apiKey:query":e.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":e.cookies[n.fieldName]=n.value;break;case"http:basic":t2r(e,n);break;case"http:custom":break;case"http:bearer":Xee(e,n);break;case"oauth2":Xee(e,n);break;case"oauth2:password":Xee(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":Xee(e,n);break;default:throw tD.unrecognizedType(o)}}),e)}function t2r(t,e){e.value!=null&&(t.basic=e.value)}function Xee(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),t.headers[e.fieldName]=r}function r2r(t){return zwt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,e2r.env)().MISTRAL_API_KEY}])}async function n2r(t){if(t!=null)return typeof t=="function"?t():t}});var POe=b(Os=>{"use strict";var o2r=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i2r=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a2r=Os&&Os.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o2r(e,t,r);return i2r(e,t),e};Object.defineProperty(Os,"__esModule",{value:!0});Os.ImageURL$=Os.ImageURL$outboundSchema=Os.ImageURL$inboundSchema=void 0;Os.imageURLToJSON=u2r;Os.imageURLFromJSON=l2r;var AT=a2r(ge()),s2r=de();Os.ImageURL$inboundSchema=AT.object({url:AT.string(),detail:AT.nullable(AT.string()).optional()});Os.ImageURL$outboundSchema=AT.object({url:AT.string(),detail:AT.nullable(AT.string()).optional()});var Hwt;(function(t){t.inboundSchema=Os.ImageURL$inboundSchema,t.outboundSchema=Os.ImageURL$outboundSchema})(Hwt||(Os.ImageURL$=Hwt={}));function u2r(t){return JSON.stringify(Os.ImageURL$outboundSchema.parse(t))}function l2r(t){return(0,s2r.safeParse)(t,e=>Os.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var TOe=b(Qt=>{"use strict";var c2r=Qt&&Qt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d2r=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f2r=Qt&&Qt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c2r(e,t,r);return d2r(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.ImageURLChunk$=Qt.ImageURLChunk$outboundSchema=Qt.ImageURLChunk$inboundSchema=Qt.ImageURLChunkType$=Qt.ImageURLChunkType$outboundSchema=Qt.ImageURLChunkType$inboundSchema=Qt.ImageURLChunkImageURL$=Qt.ImageURLChunkImageURL$outboundSchema=Qt.ImageURLChunkImageURL$inboundSchema=Qt.ImageURLChunkType=void 0;Qt.imageURLChunkImageURLToJSON=p2r;Qt.imageURLChunkImageURLFromJSON=h2r;Qt.imageURLChunkToJSON=m2r;Qt.imageURLChunkFromJSON=g2r;var Vg=f2r(ge()),Gwt=Ee(),Kwt=de(),Qee=POe();Qt.ImageURLChunkType={ImageUrl:"image_url"};Qt.ImageURLChunkImageURL$inboundSchema=Vg.union([Qee.ImageURL$inboundSchema,Vg.string()]);Qt.ImageURLChunkImageURL$outboundSchema=Vg.union([Qee.ImageURL$outboundSchema,Vg.string()]);var Vwt;(function(t){t.inboundSchema=Qt.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Qt.ImageURLChunkImageURL$outboundSchema})(Vwt||(Qt.ImageURLChunkImageURL$=Vwt={}));function p2r(t){return JSON.stringify(Qt.ImageURLChunkImageURL$outboundSchema.parse(t))}function h2r(t){return(0,Kwt.safeParse)(t,e=>Qt.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Qt.ImageURLChunkType$inboundSchema=Vg.nativeEnum(Qt.ImageURLChunkType);Qt.ImageURLChunkType$outboundSchema=Qt.ImageURLChunkType$inboundSchema;var Wwt;(function(t){t.inboundSchema=Qt.ImageURLChunkType$inboundSchema,t.outboundSchema=Qt.ImageURLChunkType$outboundSchema})(Wwt||(Qt.ImageURLChunkType$=Wwt={}));Qt.ImageURLChunk$inboundSchema=Vg.object({image_url:Vg.union([Qee.ImageURL$inboundSchema,Vg.string()]),type:Qt.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,Gwt.remap)(t,{image_url:"imageUrl"}));Qt.ImageURLChunk$outboundSchema=Vg.object({imageUrl:Vg.union([Qee.ImageURL$outboundSchema,Vg.string()]),type:Qt.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,Gwt.remap)(t,{imageUrl:"image_url"}));var Jwt;(function(t){t.inboundSchema=Qt.ImageURLChunk$inboundSchema,t.outboundSchema=Qt.ImageURLChunk$outboundSchema})(Jwt||(Qt.ImageURLChunk$=Jwt={}));function m2r(t){return JSON.stringify(Qt.ImageURLChunk$outboundSchema.parse(t))}function g2r(t){return(0,Kwt.safeParse)(t,e=>Qt.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var MOe=b(Tn=>{"use strict";var y2r=Tn&&Tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b2r=Tn&&Tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_2r=Tn&&Tn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y2r(e,t,r);return b2r(e,t),e};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.ReferenceChunk$=Tn.ReferenceChunk$outboundSchema=Tn.ReferenceChunk$inboundSchema=Tn.ReferenceChunkType$=Tn.ReferenceChunkType$outboundSchema=Tn.ReferenceChunkType$inboundSchema=Tn.ReferenceChunkType=void 0;Tn.referenceChunkToJSON=w2r;Tn.referenceChunkFromJSON=S2r;var rD=_2r(ge()),Zwt=Ee(),v2r=de();Tn.ReferenceChunkType={Reference:"reference"};Tn.ReferenceChunkType$inboundSchema=rD.nativeEnum(Tn.ReferenceChunkType);Tn.ReferenceChunkType$outboundSchema=Tn.ReferenceChunkType$inboundSchema;var Ywt;(function(t){t.inboundSchema=Tn.ReferenceChunkType$inboundSchema,t.outboundSchema=Tn.ReferenceChunkType$outboundSchema})(Ywt||(Tn.ReferenceChunkType$=Ywt={}));Tn.ReferenceChunk$inboundSchema=rD.object({reference_ids:rD.array(rD.number().int()),type:Tn.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,Zwt.remap)(t,{reference_ids:"referenceIds"}));Tn.ReferenceChunk$outboundSchema=rD.object({referenceIds:rD.array(rD.number().int()),type:Tn.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,Zwt.remap)(t,{referenceIds:"reference_ids"}));var Xwt;(function(t){t.inboundSchema=Tn.ReferenceChunk$inboundSchema,t.outboundSchema=Tn.ReferenceChunk$outboundSchema})(Xwt||(Tn.ReferenceChunk$=Xwt={}));function w2r(t){return JSON.stringify(Tn.ReferenceChunk$outboundSchema.parse(t))}function S2r(t){return(0,v2r.safeParse)(t,e=>Tn.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var ete=b(Mn=>{"use strict";var x2r=Mn&&Mn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C2r=Mn&&Mn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2r=Mn&&Mn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x2r(e,t,r);return C2r(e,t),e};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.TextChunk$=Mn.TextChunk$outboundSchema=Mn.TextChunk$inboundSchema=Mn.TextChunkType$=Mn.TextChunkType$outboundSchema=Mn.TextChunkType$inboundSchema=Mn.TextChunkType=void 0;Mn.textChunkToJSON=P2r;Mn.textChunkFromJSON=T2r;var v8=O2r(ge()),E2r=de();Mn.TextChunkType={Text:"text"};Mn.TextChunkType$inboundSchema=v8.nativeEnum(Mn.TextChunkType);Mn.TextChunkType$outboundSchema=Mn.TextChunkType$inboundSchema;var Qwt;(function(t){t.inboundSchema=Mn.TextChunkType$inboundSchema,t.outboundSchema=Mn.TextChunkType$outboundSchema})(Qwt||(Mn.TextChunkType$=Qwt={}));Mn.TextChunk$inboundSchema=v8.object({text:v8.string(),type:Mn.TextChunkType$inboundSchema.default("text")});Mn.TextChunk$outboundSchema=v8.object({text:v8.string(),type:Mn.TextChunkType$outboundSchema.default("text")});var eSt;(function(t){t.inboundSchema=Mn.TextChunk$inboundSchema,t.outboundSchema=Mn.TextChunk$outboundSchema})(eSt||(Mn.TextChunk$=eSt={}));function P2r(t){return JSON.stringify(Mn.TextChunk$outboundSchema.parse(t))}function T2r(t){return(0,E2r.safeParse)(t,e=>Mn.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var DB=b(Es=>{"use strict";var M2r=Es&&Es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A2r=Es&&Es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R2r=Es&&Es.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M2r(e,t,r);return A2r(e,t),e};Object.defineProperty(Es,"__esModule",{value:!0});Es.ContentChunk$=Es.ContentChunk$outboundSchema=Es.ContentChunk$inboundSchema=void 0;Es.contentChunkToJSON=D2r;Es.contentChunkFromJSON=j2r;var Hf=R2r(ge()),I2r=de(),rSt=TOe(),nSt=MOe(),oSt=ete();Es.ContentChunk$inboundSchema=Hf.union([rSt.ImageURLChunk$inboundSchema.and(Hf.object({type:Hf.literal("image_url")}).transform(t=>({type:t.type}))),oSt.TextChunk$inboundSchema.and(Hf.object({type:Hf.literal("text")}).transform(t=>({type:t.type}))),nSt.ReferenceChunk$inboundSchema.and(Hf.object({type:Hf.literal("reference")}).transform(t=>({type:t.type})))]);Es.ContentChunk$outboundSchema=Hf.union([rSt.ImageURLChunk$outboundSchema.and(Hf.object({type:Hf.literal("image_url")}).transform(t=>({type:t.type}))),oSt.TextChunk$outboundSchema.and(Hf.object({type:Hf.literal("text")}).transform(t=>({type:t.type}))),nSt.ReferenceChunk$outboundSchema.and(Hf.object({type:Hf.literal("reference")}).transform(t=>({type:t.type})))]);var tSt;(function(t){t.inboundSchema=Es.ContentChunk$inboundSchema,t.outboundSchema=Es.ContentChunk$outboundSchema})(tSt||(Es.ContentChunk$=tSt={}));function D2r(t){return JSON.stringify(Es.ContentChunk$outboundSchema.parse(t))}function j2r(t){return(0,I2r.safeParse)(t,e=>Es.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var AOe=b(Wn=>{"use strict";var N2r=Wn&&Wn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L2r=Wn&&Wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F2r=Wn&&Wn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N2r(e,t,r);return L2r(e,t),e};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.FunctionCall$=Wn.FunctionCall$outboundSchema=Wn.FunctionCall$inboundSchema=Wn.Arguments$=Wn.Arguments$outboundSchema=Wn.Arguments$inboundSchema=void 0;Wn.argumentsToJSON=k2r;Wn.argumentsFromJSON=B2r;Wn.functionCallToJSON=$2r;Wn.functionCallFromJSON=q2r;var Ps=F2r(ge()),sSt=de();Wn.Arguments$inboundSchema=Ps.union([Ps.record(Ps.any()),Ps.string()]);Wn.Arguments$outboundSchema=Ps.union([Ps.record(Ps.any()),Ps.string()]);var iSt;(function(t){t.inboundSchema=Wn.Arguments$inboundSchema,t.outboundSchema=Wn.Arguments$outboundSchema})(iSt||(Wn.Arguments$=iSt={}));function k2r(t){return JSON.stringify(Wn.Arguments$outboundSchema.parse(t))}function B2r(t){return(0,sSt.safeParse)(t,e=>Wn.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Wn.FunctionCall$inboundSchema=Ps.object({name:Ps.string(),arguments:Ps.union([Ps.record(Ps.any()),Ps.string()])});Wn.FunctionCall$outboundSchema=Ps.object({name:Ps.string(),arguments:Ps.union([Ps.record(Ps.any()),Ps.string()])});var aSt;(function(t){t.inboundSchema=Wn.FunctionCall$inboundSchema,t.outboundSchema=Wn.FunctionCall$outboundSchema})(aSt||(Wn.FunctionCall$=aSt={}));function $2r(t){return JSON.stringify(Wn.FunctionCall$outboundSchema.parse(t))}function q2r(t){return(0,sSt.safeParse)(t,e=>Wn.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var RT=b(ROe=>{"use strict";Object.defineProperty(ROe,"__esModule",{value:!0});ROe.catchUnrecognizedEnum=U2r;function U2r(t){return t}});var w8=b(Ts=>{"use strict";var z2r=Ts&&Ts.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H2r=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V2r=Ts&&Ts.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&z2r(e,t,r);return H2r(e,t),e};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.ToolTypes$=Ts.ToolTypes$outboundSchema=Ts.ToolTypes$inboundSchema=Ts.ToolTypes=void 0;var nD=V2r(ge()),W2r=RT();Ts.ToolTypes={Function:"function"};Ts.ToolTypes$inboundSchema=nD.union([nD.nativeEnum(Ts.ToolTypes),nD.string().transform(W2r.catchUnrecognizedEnum)]);Ts.ToolTypes$outboundSchema=nD.union([nD.nativeEnum(Ts.ToolTypes),nD.string().and(nD.custom())]);var uSt;(function(t){t.inboundSchema=Ts.ToolTypes$inboundSchema,t.outboundSchema=Ts.ToolTypes$outboundSchema})(uSt||(Ts.ToolTypes$=uSt={}))});var tte=b(Ms=>{"use strict";var J2r=Ms&&Ms.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G2r=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K2r=Ms&&Ms.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J2r(e,t,r);return G2r(e,t),e};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.ToolCall$=Ms.ToolCall$outboundSchema=Ms.ToolCall$inboundSchema=void 0;Ms.toolCallToJSON=X2r;Ms.toolCallFromJSON=Z2r;var jB=K2r(ge()),Y2r=de(),cSt=AOe(),dSt=w8();Ms.ToolCall$inboundSchema=jB.object({id:jB.string().default("null"),type:dSt.ToolTypes$inboundSchema.optional(),function:cSt.FunctionCall$inboundSchema,index:jB.number().int().default(0)});Ms.ToolCall$outboundSchema=jB.object({id:jB.string().default("null"),type:dSt.ToolTypes$outboundSchema.optional(),function:cSt.FunctionCall$outboundSchema,index:jB.number().int().default(0)});var lSt;(function(t){t.inboundSchema=Ms.ToolCall$inboundSchema,t.outboundSchema=Ms.ToolCall$outboundSchema})(lSt||(Ms.ToolCall$=lSt={}));function X2r(t){return JSON.stringify(Ms.ToolCall$outboundSchema.parse(t))}function Z2r(t){return(0,Y2r.safeParse)(t,e=>Ms.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var IT=b(er=>{"use strict";var Q2r=er&&er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e4r=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t4r=er&&er.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q2r(e,t,r);return e4r(e,t),e};Object.defineProperty(er,"__esModule",{value:!0});er.AssistantMessage$=er.AssistantMessage$outboundSchema=er.AssistantMessage$inboundSchema=er.AssistantMessageRole$=er.AssistantMessageRole$outboundSchema=er.AssistantMessageRole$inboundSchema=er.AssistantMessageContent$=er.AssistantMessageContent$outboundSchema=er.AssistantMessageContent$inboundSchema=er.AssistantMessageRole=void 0;er.assistantMessageContentToJSON=r4r;er.assistantMessageContentFromJSON=n4r;er.assistantMessageToJSON=o4r;er.assistantMessageFromJSON=i4r;var xa=t4r(ge()),mSt=Ee(),gSt=de(),rte=DB(),ySt=tte();er.AssistantMessageRole={Assistant:"assistant"};er.AssistantMessageContent$inboundSchema=xa.union([xa.string(),xa.array(rte.ContentChunk$inboundSchema)]);er.AssistantMessageContent$outboundSchema=xa.union([xa.string(),xa.array(rte.ContentChunk$outboundSchema)]);var fSt;(function(t){t.inboundSchema=er.AssistantMessageContent$inboundSchema,t.outboundSchema=er.AssistantMessageContent$outboundSchema})(fSt||(er.AssistantMessageContent$=fSt={}));function r4r(t){return JSON.stringify(er.AssistantMessageContent$outboundSchema.parse(t))}function n4r(t){return(0,gSt.safeParse)(t,e=>er.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}er.AssistantMessageRole$inboundSchema=xa.nativeEnum(er.AssistantMessageRole);er.AssistantMessageRole$outboundSchema=er.AssistantMessageRole$inboundSchema;var pSt;(function(t){t.inboundSchema=er.AssistantMessageRole$inboundSchema,t.outboundSchema=er.AssistantMessageRole$outboundSchema})(pSt||(er.AssistantMessageRole$=pSt={}));er.AssistantMessage$inboundSchema=xa.object({content:xa.nullable(xa.union([xa.string(),xa.array(rte.ContentChunk$inboundSchema)])).optional(),tool_calls:xa.nullable(xa.array(ySt.ToolCall$inboundSchema)).optional(),prefix:xa.boolean().default(!1),role:er.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,mSt.remap)(t,{tool_calls:"toolCalls"}));er.AssistantMessage$outboundSchema=xa.object({content:xa.nullable(xa.union([xa.string(),xa.array(rte.ContentChunk$outboundSchema)])).optional(),toolCalls:xa.nullable(xa.array(ySt.ToolCall$outboundSchema)).optional(),prefix:xa.boolean().default(!1),role:er.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,mSt.remap)(t,{toolCalls:"tool_calls"}));var hSt;(function(t){t.inboundSchema=er.AssistantMessage$inboundSchema,t.outboundSchema=er.AssistantMessage$outboundSchema})(hSt||(er.AssistantMessage$=hSt={}));function o4r(t){return JSON.stringify(er.AssistantMessage$outboundSchema.parse(t))}function i4r(t){return(0,gSt.safeParse)(t,e=>er.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var NB=b(Jn=>{"use strict";var a4r=Jn&&Jn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s4r=Jn&&Jn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u4r=Jn&&Jn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a4r(e,t,r);return s4r(e,t),e};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.Prediction$=Jn.Prediction$outboundSchema=Jn.Prediction$inboundSchema=Jn.PredictionType$=Jn.PredictionType$outboundSchema=Jn.PredictionType$inboundSchema=Jn.PredictionType=void 0;Jn.predictionToJSON=c4r;Jn.predictionFromJSON=d4r;var oD=u4r(ge()),l4r=de();Jn.PredictionType={Content:"content"};Jn.PredictionType$inboundSchema=oD.nativeEnum(Jn.PredictionType);Jn.PredictionType$outboundSchema=Jn.PredictionType$inboundSchema;var bSt;(function(t){t.inboundSchema=Jn.PredictionType$inboundSchema,t.outboundSchema=Jn.PredictionType$outboundSchema})(bSt||(Jn.PredictionType$=bSt={}));Jn.Prediction$inboundSchema=oD.object({type:oD.literal("content").default("content"),content:oD.string().default("")});Jn.Prediction$outboundSchema=oD.object({type:oD.literal("content").default("content"),content:oD.string().default("")});var _St;(function(t){t.inboundSchema=Jn.Prediction$inboundSchema,t.outboundSchema=Jn.Prediction$outboundSchema})(_St||(Jn.Prediction$=_St={}));function c4r(t){return JSON.stringify(Jn.Prediction$outboundSchema.parse(t))}function d4r(t){return(0,l4r.safeParse)(t,e=>Jn.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var IOe=b(As=>{"use strict";var f4r=As&&As.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p4r=As&&As.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h4r=As&&As.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f4r(e,t,r);return p4r(e,t),e};Object.defineProperty(As,"__esModule",{value:!0});As.JsonSchema$=As.JsonSchema$outboundSchema=As.JsonSchema$inboundSchema=void 0;As.jsonSchemaToJSON=g4r;As.jsonSchemaFromJSON=y4r;var Vf=h4r(ge()),wSt=Ee(),m4r=de();As.JsonSchema$inboundSchema=Vf.object({name:Vf.string(),description:Vf.nullable(Vf.string()).optional(),schema:Vf.record(Vf.any()),strict:Vf.boolean().default(!1)}).transform(t=>(0,wSt.remap)(t,{schema:"schemaDefinition"}));As.JsonSchema$outboundSchema=Vf.object({name:Vf.string(),description:Vf.nullable(Vf.string()).optional(),schemaDefinition:Vf.record(Vf.any()),strict:Vf.boolean().default(!1)}).transform(t=>(0,wSt.remap)(t,{schemaDefinition:"schema"}));var vSt;(function(t){t.inboundSchema=As.JsonSchema$inboundSchema,t.outboundSchema=As.JsonSchema$outboundSchema})(vSt||(As.JsonSchema$=vSt={}));function g4r(t){return JSON.stringify(As.JsonSchema$outboundSchema.parse(t))}function y4r(t){return(0,m4r.safeParse)(t,e=>As.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var DOe=b(Rs=>{"use strict";var b4r=Rs&&Rs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_4r=Rs&&Rs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v4r=Rs&&Rs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b4r(e,t,r);return _4r(e,t),e};Object.defineProperty(Rs,"__esModule",{value:!0});Rs.ResponseFormats$=Rs.ResponseFormats$outboundSchema=Rs.ResponseFormats$inboundSchema=Rs.ResponseFormats=void 0;var w4r=v4r(ge());Rs.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Rs.ResponseFormats$inboundSchema=w4r.nativeEnum(Rs.ResponseFormats);Rs.ResponseFormats$outboundSchema=Rs.ResponseFormats$inboundSchema;var SSt;(function(t){t.inboundSchema=Rs.ResponseFormats$inboundSchema,t.outboundSchema=Rs.ResponseFormats$outboundSchema})(SSt||(Rs.ResponseFormats$=SSt={}))});var LB=b(Is=>{"use strict";var S4r=Is&&Is.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x4r=Is&&Is.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C4r=Is&&Is.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S4r(e,t,r);return x4r(e,t),e};Object.defineProperty(Is,"__esModule",{value:!0});Is.ResponseFormat$=Is.ResponseFormat$outboundSchema=Is.ResponseFormat$inboundSchema=void 0;Is.responseFormatToJSON=E4r;Is.responseFormatFromJSON=P4r;var nte=C4r(ge()),CSt=Ee(),O4r=de(),OSt=IOe(),ESt=DOe();Is.ResponseFormat$inboundSchema=nte.object({type:ESt.ResponseFormats$inboundSchema.optional(),json_schema:nte.nullable(OSt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,CSt.remap)(t,{json_schema:"jsonSchema"}));Is.ResponseFormat$outboundSchema=nte.object({type:ESt.ResponseFormats$outboundSchema.optional(),jsonSchema:nte.nullable(OSt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,CSt.remap)(t,{jsonSchema:"json_schema"}));var xSt;(function(t){t.inboundSchema=Is.ResponseFormat$inboundSchema,t.outboundSchema=Is.ResponseFormat$outboundSchema})(xSt||(Is.ResponseFormat$=xSt={}));function E4r(t){return JSON.stringify(Is.ResponseFormat$outboundSchema.parse(t))}function P4r(t){return(0,O4r.safeParse)(t,e=>Is.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var iD=b(tr=>{"use strict";var T4r=tr&&tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M4r=tr&&tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A4r=tr&&tr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&T4r(e,t,r);return M4r(e,t),e};Object.defineProperty(tr,"__esModule",{value:!0});tr.SystemMessage$=tr.SystemMessage$outboundSchema=tr.SystemMessage$inboundSchema=tr.Role$=tr.Role$outboundSchema=tr.Role$inboundSchema=tr.SystemMessageContent$=tr.SystemMessageContent$outboundSchema=tr.SystemMessageContent$inboundSchema=tr.Role=void 0;tr.systemMessageContentToJSON=R4r;tr.systemMessageContentFromJSON=I4r;tr.systemMessageToJSON=D4r;tr.systemMessageFromJSON=j4r;var Gd=A4r(ge()),ASt=de(),ote=ete();tr.Role={System:"system"};tr.SystemMessageContent$inboundSchema=Gd.union([Gd.string(),Gd.array(ote.TextChunk$inboundSchema)]);tr.SystemMessageContent$outboundSchema=Gd.union([Gd.string(),Gd.array(ote.TextChunk$outboundSchema)]);var PSt;(function(t){t.inboundSchema=tr.SystemMessageContent$inboundSchema,t.outboundSchema=tr.SystemMessageContent$outboundSchema})(PSt||(tr.SystemMessageContent$=PSt={}));function R4r(t){return JSON.stringify(tr.SystemMessageContent$outboundSchema.parse(t))}function I4r(t){return(0,ASt.safeParse)(t,e=>tr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}tr.Role$inboundSchema=Gd.nativeEnum(tr.Role);tr.Role$outboundSchema=tr.Role$inboundSchema;var TSt;(function(t){t.inboundSchema=tr.Role$inboundSchema,t.outboundSchema=tr.Role$outboundSchema})(TSt||(tr.Role$=TSt={}));tr.SystemMessage$inboundSchema=Gd.object({content:Gd.union([Gd.string(),Gd.array(ote.TextChunk$inboundSchema)]),role:tr.Role$inboundSchema.default("system")});tr.SystemMessage$outboundSchema=Gd.object({content:Gd.union([Gd.string(),Gd.array(ote.TextChunk$outboundSchema)]),role:tr.Role$outboundSchema.default("system")});var MSt;(function(t){t.inboundSchema=tr.SystemMessage$inboundSchema,t.outboundSchema=tr.SystemMessage$outboundSchema})(MSt||(tr.SystemMessage$=MSt={}));function D4r(t){return JSON.stringify(tr.SystemMessage$outboundSchema.parse(t))}function j4r(t){return(0,ASt.safeParse)(t,e=>tr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var jOe=b(Ds=>{"use strict";var N4r=Ds&&Ds.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L4r=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F4r=Ds&&Ds.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N4r(e,t,r);return L4r(e,t),e};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.FunctionT$=Ds.FunctionT$outboundSchema=Ds.FunctionT$inboundSchema=void 0;Ds.functionToJSON=B4r;Ds.functionFromJSON=$4r;var im=F4r(ge()),k4r=de();Ds.FunctionT$inboundSchema=im.object({name:im.string(),description:im.string().default(""),strict:im.boolean().default(!1),parameters:im.record(im.any())});Ds.FunctionT$outboundSchema=im.object({name:im.string(),description:im.string().default(""),strict:im.boolean().default(!1),parameters:im.record(im.any())});var RSt;(function(t){t.inboundSchema=Ds.FunctionT$inboundSchema,t.outboundSchema=Ds.FunctionT$outboundSchema})(RSt||(Ds.FunctionT$=RSt={}));function B4r(t){return JSON.stringify(Ds.FunctionT$outboundSchema.parse(t))}function $4r(t){return(0,k4r.safeParse)(t,e=>Ds.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var FB=b(js=>{"use strict";var q4r=js&&js.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U4r=js&&js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z4r=js&&js.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4r(e,t,r);return U4r(e,t),e};Object.defineProperty(js,"__esModule",{value:!0});js.Tool$=js.Tool$outboundSchema=js.Tool$inboundSchema=void 0;js.toolToJSON=V4r;js.toolFromJSON=W4r;var DSt=z4r(ge()),H4r=de(),jSt=jOe(),NSt=w8();js.Tool$inboundSchema=DSt.object({type:NSt.ToolTypes$inboundSchema.optional(),function:jSt.FunctionT$inboundSchema});js.Tool$outboundSchema=DSt.object({type:NSt.ToolTypes$outboundSchema.optional(),function:jSt.FunctionT$outboundSchema});var ISt;(function(t){t.inboundSchema=js.Tool$inboundSchema,t.outboundSchema=js.Tool$outboundSchema})(ISt||(js.Tool$=ISt={}));function V4r(t){return JSON.stringify(js.Tool$outboundSchema.parse(t))}function W4r(t){return(0,H4r.safeParse)(t,e=>js.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var NOe=b(Ns=>{"use strict";var J4r=Ns&&Ns.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G4r=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K4r=Ns&&Ns.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J4r(e,t,r);return G4r(e,t),e};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.FunctionName$=Ns.FunctionName$outboundSchema=Ns.FunctionName$inboundSchema=void 0;Ns.functionNameToJSON=X4r;Ns.functionNameFromJSON=Z4r;var ite=K4r(ge()),Y4r=de();Ns.FunctionName$inboundSchema=ite.object({name:ite.string()});Ns.FunctionName$outboundSchema=ite.object({name:ite.string()});var LSt;(function(t){t.inboundSchema=Ns.FunctionName$inboundSchema,t.outboundSchema=Ns.FunctionName$outboundSchema})(LSt||(Ns.FunctionName$=LSt={}));function X4r(t){return JSON.stringify(Ns.FunctionName$outboundSchema.parse(t))}function Z4r(t){return(0,Y4r.safeParse)(t,e=>Ns.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var kB=b(Ls=>{"use strict";var Q4r=Ls&&Ls.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e3r=Ls&&Ls.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t3r=Ls&&Ls.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q4r(e,t,r);return e3r(e,t),e};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.ToolChoice$=Ls.ToolChoice$outboundSchema=Ls.ToolChoice$inboundSchema=void 0;Ls.toolChoiceToJSON=n3r;Ls.toolChoiceFromJSON=o3r;var kSt=t3r(ge()),r3r=de(),BSt=NOe(),$St=w8();Ls.ToolChoice$inboundSchema=kSt.object({type:$St.ToolTypes$inboundSchema.optional(),function:BSt.FunctionName$inboundSchema});Ls.ToolChoice$outboundSchema=kSt.object({type:$St.ToolTypes$outboundSchema.optional(),function:BSt.FunctionName$outboundSchema});var FSt;(function(t){t.inboundSchema=Ls.ToolChoice$inboundSchema,t.outboundSchema=Ls.ToolChoice$outboundSchema})(FSt||(Ls.ToolChoice$=FSt={}));function n3r(t){return JSON.stringify(Ls.ToolChoice$outboundSchema.parse(t))}function o3r(t){return(0,r3r.safeParse)(t,e=>Ls.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var BB=b(Fs=>{"use strict";var i3r=Fs&&Fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a3r=Fs&&Fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s3r=Fs&&Fs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i3r(e,t,r);return a3r(e,t),e};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ToolChoiceEnum$=Fs.ToolChoiceEnum$outboundSchema=Fs.ToolChoiceEnum$inboundSchema=Fs.ToolChoiceEnum=void 0;var u3r=s3r(ge());Fs.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Fs.ToolChoiceEnum$inboundSchema=u3r.nativeEnum(Fs.ToolChoiceEnum);Fs.ToolChoiceEnum$outboundSchema=Fs.ToolChoiceEnum$inboundSchema;var qSt;(function(t){t.inboundSchema=Fs.ToolChoiceEnum$inboundSchema,t.outboundSchema=Fs.ToolChoiceEnum$outboundSchema})(qSt||(Fs.ToolChoiceEnum$=qSt={}))});var aD=b(rr=>{"use strict";var l3r=rr&&rr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),c3r=rr&&rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d3r=rr&&rr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&l3r(e,t,r);return c3r(e,t),e};Object.defineProperty(rr,"__esModule",{value:!0});rr.ToolMessage$=rr.ToolMessage$outboundSchema=rr.ToolMessage$inboundSchema=rr.ToolMessageRole$=rr.ToolMessageRole$outboundSchema=rr.ToolMessageRole$inboundSchema=rr.ToolMessageContent$=rr.ToolMessageContent$outboundSchema=rr.ToolMessageContent$inboundSchema=rr.ToolMessageRole=void 0;rr.toolMessageContentToJSON=f3r;rr.toolMessageContentFromJSON=p3r;rr.toolMessageToJSON=h3r;rr.toolMessageFromJSON=m3r;var Ai=d3r(ge()),VSt=Ee(),WSt=de(),ate=DB();rr.ToolMessageRole={Tool:"tool"};rr.ToolMessageContent$inboundSchema=Ai.union([Ai.string(),Ai.array(ate.ContentChunk$inboundSchema)]);rr.ToolMessageContent$outboundSchema=Ai.union([Ai.string(),Ai.array(ate.ContentChunk$outboundSchema)]);var USt;(function(t){t.inboundSchema=rr.ToolMessageContent$inboundSchema,t.outboundSchema=rr.ToolMessageContent$outboundSchema})(USt||(rr.ToolMessageContent$=USt={}));function f3r(t){return JSON.stringify(rr.ToolMessageContent$outboundSchema.parse(t))}function p3r(t){return(0,WSt.safeParse)(t,e=>rr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}rr.ToolMessageRole$inboundSchema=Ai.nativeEnum(rr.ToolMessageRole);rr.ToolMessageRole$outboundSchema=rr.ToolMessageRole$inboundSchema;var zSt;(function(t){t.inboundSchema=rr.ToolMessageRole$inboundSchema,t.outboundSchema=rr.ToolMessageRole$outboundSchema})(zSt||(rr.ToolMessageRole$=zSt={}));rr.ToolMessage$inboundSchema=Ai.object({content:Ai.nullable(Ai.union([Ai.string(),Ai.array(ate.ContentChunk$inboundSchema)])),tool_call_id:Ai.nullable(Ai.string()).optional(),name:Ai.nullable(Ai.string()).optional(),role:rr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,VSt.remap)(t,{tool_call_id:"toolCallId"}));rr.ToolMessage$outboundSchema=Ai.object({content:Ai.nullable(Ai.union([Ai.string(),Ai.array(ate.ContentChunk$outboundSchema)])),toolCallId:Ai.nullable(Ai.string()).optional(),name:Ai.nullable(Ai.string()).optional(),role:rr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,VSt.remap)(t,{toolCallId:"tool_call_id"}));var HSt;(function(t){t.inboundSchema=rr.ToolMessage$inboundSchema,t.outboundSchema=rr.ToolMessage$outboundSchema})(HSt||(rr.ToolMessage$=HSt={}));function h3r(t){return JSON.stringify(rr.ToolMessage$outboundSchema.parse(t))}function m3r(t){return(0,WSt.safeParse)(t,e=>rr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var sD=b(nr=>{"use strict";var g3r=nr&&nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y3r=nr&&nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b3r=nr&&nr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g3r(e,t,r);return y3r(e,t),e};Object.defineProperty(nr,"__esModule",{value:!0});nr.UserMessage$=nr.UserMessage$outboundSchema=nr.UserMessage$inboundSchema=nr.UserMessageRole$=nr.UserMessageRole$outboundSchema=nr.UserMessageRole$inboundSchema=nr.UserMessageContent$=nr.UserMessageContent$outboundSchema=nr.UserMessageContent$inboundSchema=nr.UserMessageRole=void 0;nr.userMessageContentToJSON=_3r;nr.userMessageContentFromJSON=v3r;nr.userMessageToJSON=w3r;nr.userMessageFromJSON=S3r;var bc=b3r(ge()),YSt=de(),ste=DB();nr.UserMessageRole={User:"user"};nr.UserMessageContent$inboundSchema=bc.union([bc.string(),bc.array(ste.ContentChunk$inboundSchema)]);nr.UserMessageContent$outboundSchema=bc.union([bc.string(),bc.array(ste.ContentChunk$outboundSchema)]);var JSt;(function(t){t.inboundSchema=nr.UserMessageContent$inboundSchema,t.outboundSchema=nr.UserMessageContent$outboundSchema})(JSt||(nr.UserMessageContent$=JSt={}));function _3r(t){return JSON.stringify(nr.UserMessageContent$outboundSchema.parse(t))}function v3r(t){return(0,YSt.safeParse)(t,e=>nr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}nr.UserMessageRole$inboundSchema=bc.nativeEnum(nr.UserMessageRole);nr.UserMessageRole$outboundSchema=nr.UserMessageRole$inboundSchema;var GSt;(function(t){t.inboundSchema=nr.UserMessageRole$inboundSchema,t.outboundSchema=nr.UserMessageRole$outboundSchema})(GSt||(nr.UserMessageRole$=GSt={}));nr.UserMessage$inboundSchema=bc.object({content:bc.nullable(bc.union([bc.string(),bc.array(ste.ContentChunk$inboundSchema)])),role:nr.UserMessageRole$inboundSchema.default("user")});nr.UserMessage$outboundSchema=bc.object({content:bc.nullable(bc.union([bc.string(),bc.array(ste.ContentChunk$outboundSchema)])),role:nr.UserMessageRole$outboundSchema.default("user")});var KSt;(function(t){t.inboundSchema=nr.UserMessage$inboundSchema,t.outboundSchema=nr.UserMessage$outboundSchema})(KSt||(nr.UserMessage$=KSt={}));function w3r(t){return JSON.stringify(nr.UserMessage$outboundSchema.parse(t))}function S3r(t){return(0,YSt.safeParse)(t,e=>nr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var ixt=b(Ot=>{"use strict";var x3r=Ot&&Ot.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C3r=Ot&&Ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O3r=Ot&&Ot.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x3r(e,t,r);return C3r(e,t),e};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=E3r;Ot.agentsCompletionRequestStopFromJSON=P3r;Ot.agentsCompletionRequestMessagesToJSON=T3r;Ot.agentsCompletionRequestMessagesFromJSON=M3r;Ot.agentsCompletionRequestToolChoiceToJSON=A3r;Ot.agentsCompletionRequestToolChoiceFromJSON=R3r;Ot.agentsCompletionRequestToJSON=I3r;Ot.agentsCompletionRequestFromJSON=D3r;var Le=O3r(ge()),txt=Ee(),ute=de(),lte=IT(),rxt=NB(),nxt=LB(),cte=iD(),oxt=FB(),dte=kB(),fte=BB(),pte=aD(),hte=sD();Ot.AgentsCompletionRequestStop$inboundSchema=Le.union([Le.string(),Le.array(Le.string())]);Ot.AgentsCompletionRequestStop$outboundSchema=Le.union([Le.string(),Le.array(Le.string())]);var XSt;(function(t){t.inboundSchema=Ot.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Ot.AgentsCompletionRequestStop$outboundSchema})(XSt||(Ot.AgentsCompletionRequestStop$=XSt={}));function E3r(t){return JSON.stringify(Ot.AgentsCompletionRequestStop$outboundSchema.parse(t))}function P3r(t){return(0,ute.safeParse)(t,e=>Ot.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Ot.AgentsCompletionRequestMessages$inboundSchema=Le.union([cte.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),hte.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),lte.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),pte.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))]);Ot.AgentsCompletionRequestMessages$outboundSchema=Le.union([cte.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),hte.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),lte.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),pte.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))]);var ZSt;(function(t){t.inboundSchema=Ot.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Ot.AgentsCompletionRequestMessages$outboundSchema})(ZSt||(Ot.AgentsCompletionRequestMessages$=ZSt={}));function T3r(t){return JSON.stringify(Ot.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function M3r(t){return(0,ute.safeParse)(t,e=>Ot.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Ot.AgentsCompletionRequestToolChoice$inboundSchema=Le.union([dte.ToolChoice$inboundSchema,fte.ToolChoiceEnum$inboundSchema]);Ot.AgentsCompletionRequestToolChoice$outboundSchema=Le.union([dte.ToolChoice$outboundSchema,fte.ToolChoiceEnum$outboundSchema]);var QSt;(function(t){t.inboundSchema=Ot.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Ot.AgentsCompletionRequestToolChoice$outboundSchema})(QSt||(Ot.AgentsCompletionRequestToolChoice$=QSt={}));function A3r(t){return JSON.stringify(Ot.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function R3r(t){return(0,ute.safeParse)(t,e=>Ot.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"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([cte.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),hte.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),lte.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),pte.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))])),response_format:nxt.ResponseFormat$inboundSchema.optional(),tools:Le.nullable(Le.array(oxt.Tool$inboundSchema)).optional(),tool_choice:Le.union([dte.ToolChoice$inboundSchema,fte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Le.number().optional(),frequency_penalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:rxt.Prediction$inboundSchema.optional(),agent_id:Le.string()}).transform(t=>(0,txt.remap)(t,{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([cte.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),hte.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),lte.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),pte.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:nxt.ResponseFormat$outboundSchema.optional(),tools:Le.nullable(Le.array(oxt.Tool$outboundSchema)).optional(),toolChoice:Le.union([dte.ToolChoice$outboundSchema,fte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Le.number().optional(),frequencyPenalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:rxt.Prediction$outboundSchema.optional(),agentId:Le.string()}).transform(t=>(0,txt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var ext;(function(t){t.inboundSchema=Ot.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Ot.AgentsCompletionRequest$outboundSchema})(ext||(Ot.AgentsCompletionRequest$=ext={}));function I3r(t){return JSON.stringify(Ot.AgentsCompletionRequest$outboundSchema.parse(t))}function D3r(t){return(0,ute.safeParse)(t,e=>Ot.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var hxt=b(Et=>{"use strict";var j3r=Et&&Et.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N3r=Et&&Et.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L3r=Et&&Et.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j3r(e,t,r);return N3r(e,t),e};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=F3r;Et.agentsCompletionStreamRequestStopFromJSON=k3r;Et.agentsCompletionStreamRequestMessagesToJSON=B3r;Et.agentsCompletionStreamRequestMessagesFromJSON=$3r;Et.agentsCompletionStreamRequestToolChoiceToJSON=q3r;Et.agentsCompletionStreamRequestToolChoiceFromJSON=U3r;Et.agentsCompletionStreamRequestToJSON=z3r;Et.agentsCompletionStreamRequestFromJSON=H3r;var Fe=L3r(ge()),cxt=Ee(),mte=de(),gte=IT(),dxt=NB(),fxt=LB(),yte=iD(),pxt=FB(),bte=kB(),_te=BB(),vte=aD(),wte=sD();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(t){t.inboundSchema=Et.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Et.AgentsCompletionStreamRequestStop$outboundSchema})(axt||(Et.AgentsCompletionStreamRequestStop$=axt={}));function F3r(t){return JSON.stringify(Et.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function k3r(t){return(0,mte.safeParse)(t,e=>Et.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Et.AgentsCompletionStreamRequestMessages$inboundSchema=Fe.union([yte.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),wte.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),gte.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role}))),vte.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role})))]);Et.AgentsCompletionStreamRequestMessages$outboundSchema=Fe.union([yte.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),wte.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),gte.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role}))),vte.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role})))]);var sxt;(function(t){t.inboundSchema=Et.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Et.AgentsCompletionStreamRequestMessages$outboundSchema})(sxt||(Et.AgentsCompletionStreamRequestMessages$=sxt={}));function B3r(t){return JSON.stringify(Et.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function $3r(t){return(0,mte.safeParse)(t,e=>Et.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Et.AgentsCompletionStreamRequestToolChoice$inboundSchema=Fe.union([bte.ToolChoice$inboundSchema,_te.ToolChoiceEnum$inboundSchema]);Et.AgentsCompletionStreamRequestToolChoice$outboundSchema=Fe.union([bte.ToolChoice$outboundSchema,_te.ToolChoiceEnum$outboundSchema]);var uxt;(function(t){t.inboundSchema=Et.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Et.AgentsCompletionStreamRequestToolChoice$outboundSchema})(uxt||(Et.AgentsCompletionStreamRequestToolChoice$=uxt={}));function q3r(t){return JSON.stringify(Et.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function U3r(t){return(0,mte.safeParse)(t,e=>Et.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"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([yte.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),wte.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),gte.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role}))),vte.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:fxt.ResponseFormat$inboundSchema.optional(),tools:Fe.nullable(Fe.array(pxt.Tool$inboundSchema)).optional(),tool_choice:Fe.union([bte.ToolChoice$inboundSchema,_te.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Fe.number().optional(),frequency_penalty:Fe.number().optional(),n:Fe.nullable(Fe.number().int()).optional(),prediction:dxt.Prediction$inboundSchema.optional(),agent_id:Fe.string()}).transform(t=>(0,cxt.remap)(t,{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([yte.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),wte.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),gte.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role}))),vte.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:fxt.ResponseFormat$outboundSchema.optional(),tools:Fe.nullable(Fe.array(pxt.Tool$outboundSchema)).optional(),toolChoice:Fe.union([bte.ToolChoice$outboundSchema,_te.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Fe.number().optional(),frequencyPenalty:Fe.number().optional(),n:Fe.nullable(Fe.number().int()).optional(),prediction:dxt.Prediction$outboundSchema.optional(),agentId:Fe.string()}).transform(t=>(0,cxt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var lxt;(function(t){t.inboundSchema=Et.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Et.AgentsCompletionStreamRequest$outboundSchema})(lxt||(Et.AgentsCompletionStreamRequest$=lxt={}));function z3r(t){return JSON.stringify(Et.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function H3r(t){return(0,mte.safeParse)(t,e=>Et.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var LOe=b(ks=>{"use strict";var V3r=ks&&ks.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W3r=ks&&ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3r=ks&&ks.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V3r(e,t,r);return W3r(e,t),e};Object.defineProperty(ks,"__esModule",{value:!0});ks.ApiEndpoint$=ks.ApiEndpoint$outboundSchema=ks.ApiEndpoint$inboundSchema=ks.ApiEndpoint=void 0;var uD=J3r(ge()),G3r=RT();ks.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};ks.ApiEndpoint$inboundSchema=uD.union([uD.nativeEnum(ks.ApiEndpoint),uD.string().transform(G3r.catchUnrecognizedEnum)]);ks.ApiEndpoint$outboundSchema=uD.union([uD.nativeEnum(ks.ApiEndpoint),uD.string().and(uD.custom())]);var mxt;(function(t){t.inboundSchema=ks.ApiEndpoint$inboundSchema,t.outboundSchema=ks.ApiEndpoint$outboundSchema})(mxt||(ks.ApiEndpoint$=mxt={}))});var bxt=b(Gn=>{"use strict";var K3r=Gn&&Gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y3r=Gn&&Gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3r=Gn&&Gn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K3r(e,t,r);return Y3r(e,t),e};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.ArchiveFTModelOut$=Gn.ArchiveFTModelOut$outboundSchema=Gn.ArchiveFTModelOut$inboundSchema=Gn.ArchiveFTModelOutObject$=Gn.ArchiveFTModelOutObject$outboundSchema=Gn.ArchiveFTModelOutObject$inboundSchema=Gn.ArchiveFTModelOutObject=void 0;Gn.archiveFTModelOutToJSON=Q3r;Gn.archiveFTModelOutFromJSON=e8r;var NC=X3r(ge()),Z3r=de();Gn.ArchiveFTModelOutObject={Model:"model"};Gn.ArchiveFTModelOutObject$inboundSchema=NC.nativeEnum(Gn.ArchiveFTModelOutObject);Gn.ArchiveFTModelOutObject$outboundSchema=Gn.ArchiveFTModelOutObject$inboundSchema;var gxt;(function(t){t.inboundSchema=Gn.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Gn.ArchiveFTModelOutObject$outboundSchema})(gxt||(Gn.ArchiveFTModelOutObject$=gxt={}));Gn.ArchiveFTModelOut$inboundSchema=NC.object({id:NC.string(),object:NC.literal("model").default("model"),archived:NC.boolean().default(!0)});Gn.ArchiveFTModelOut$outboundSchema=NC.object({id:NC.string(),object:NC.literal("model").default("model"),archived:NC.boolean().default(!0)});var yxt;(function(t){t.inboundSchema=Gn.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Gn.ArchiveFTModelOut$outboundSchema})(yxt||(Gn.ArchiveFTModelOut$=yxt={}));function Q3r(t){return JSON.stringify(Gn.ArchiveFTModelOut$outboundSchema.parse(t))}function e8r(t){return(0,Z3r.safeParse)(t,e=>Gn.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Ste=b(Bs=>{"use strict";var t8r=Bs&&Bs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r8r=Bs&&Bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n8r=Bs&&Bs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t8r(e,t,r);return r8r(e,t),e};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ModelCapabilities$=Bs.ModelCapabilities$outboundSchema=Bs.ModelCapabilities$inboundSchema=void 0;Bs.modelCapabilitiesToJSON=i8r;Bs.modelCapabilitiesFromJSON=a8r;var am=n8r(ge()),vxt=Ee(),o8r=de();Bs.ModelCapabilities$inboundSchema=am.object({completion_chat:am.boolean().default(!0),completion_fim:am.boolean().default(!1),function_calling:am.boolean().default(!0),fine_tuning:am.boolean().default(!1),vision:am.boolean().default(!1)}).transform(t=>(0,vxt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Bs.ModelCapabilities$outboundSchema=am.object({completionChat:am.boolean().default(!0),completionFim:am.boolean().default(!1),functionCalling:am.boolean().default(!0),fineTuning:am.boolean().default(!1),vision:am.boolean().default(!1)}).transform(t=>(0,vxt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var _xt;(function(t){t.inboundSchema=Bs.ModelCapabilities$inboundSchema,t.outboundSchema=Bs.ModelCapabilities$outboundSchema})(_xt||(Bs.ModelCapabilities$=_xt={}));function i8r(t){return JSON.stringify(Bs.ModelCapabilities$outboundSchema.parse(t))}function a8r(t){return(0,o8r.safeParse)(t,e=>Bs.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var FOe=b(Kn=>{"use strict";var s8r=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u8r=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l8r=Kn&&Kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s8r(e,t,r);return u8r(e,t),e};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.BaseModelCard$=Kn.BaseModelCard$outboundSchema=Kn.BaseModelCard$inboundSchema=Kn.Type$=Kn.Type$outboundSchema=Kn.Type$inboundSchema=Kn.Type=void 0;Kn.baseModelCardToJSON=d8r;Kn.baseModelCardFromJSON=f8r;var wn=l8r(ge()),xxt=Ee(),c8r=de(),Cxt=Ste();Kn.Type={Base:"base"};Kn.Type$inboundSchema=wn.nativeEnum(Kn.Type);Kn.Type$outboundSchema=Kn.Type$inboundSchema;var wxt;(function(t){t.inboundSchema=Kn.Type$inboundSchema,t.outboundSchema=Kn.Type$outboundSchema})(wxt||(Kn.Type$=wxt={}));Kn.BaseModelCard$inboundSchema=wn.object({id:wn.string(),object:wn.string().default("model"),created:wn.number().int().optional(),owned_by:wn.string().default("mistralai"),capabilities:Cxt.ModelCapabilities$inboundSchema,name:wn.nullable(wn.string()).optional(),description:wn.nullable(wn.string()).optional(),max_context_length:wn.number().int().default(32768),aliases:wn.array(wn.string()).optional(),deprecation:wn.nullable(wn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:wn.nullable(wn.number()).optional(),type:wn.literal("base").default("base")}).transform(t=>(0,xxt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Kn.BaseModelCard$outboundSchema=wn.object({id:wn.string(),object:wn.string().default("model"),created:wn.number().int().optional(),ownedBy:wn.string().default("mistralai"),capabilities:Cxt.ModelCapabilities$outboundSchema,name:wn.nullable(wn.string()).optional(),description:wn.nullable(wn.string()).optional(),maxContextLength:wn.number().int().default(32768),aliases:wn.array(wn.string()).optional(),deprecation:wn.nullable(wn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:wn.nullable(wn.number()).optional(),type:wn.literal("base").default("base")}).transform(t=>(0,xxt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var Sxt;(function(t){t.inboundSchema=Kn.BaseModelCard$inboundSchema,t.outboundSchema=Kn.BaseModelCard$outboundSchema})(Sxt||(Kn.BaseModelCard$=Sxt={}));function d8r(t){return JSON.stringify(Kn.BaseModelCard$outboundSchema.parse(t))}function f8r(t){return(0,c8r.safeParse)(t,e=>Kn.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var kOe=b($s=>{"use strict";var p8r=$s&&$s.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h8r=$s&&$s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m8r=$s&&$s.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p8r(e,t,r);return h8r(e,t),e};Object.defineProperty($s,"__esModule",{value:!0});$s.BatchError$=$s.BatchError$outboundSchema=$s.BatchError$inboundSchema=void 0;$s.batchErrorToJSON=y8r;$s.batchErrorFromJSON=b8r;var $B=m8r(ge()),g8r=de();$s.BatchError$inboundSchema=$B.object({message:$B.string(),count:$B.number().int().default(1)});$s.BatchError$outboundSchema=$B.object({message:$B.string(),count:$B.number().int().default(1)});var Oxt;(function(t){t.inboundSchema=$s.BatchError$inboundSchema,t.outboundSchema=$s.BatchError$outboundSchema})(Oxt||($s.BatchError$=Oxt={}));function y8r(t){return JSON.stringify($s.BatchError$outboundSchema.parse(t))}function b8r(t){return(0,g8r.safeParse)(t,e=>$s.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var Mxt=b(qs=>{"use strict";var _8r=qs&&qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v8r=qs&&qs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w8r=qs&&qs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_8r(e,t,r);return v8r(e,t),e};Object.defineProperty(qs,"__esModule",{value:!0});qs.BatchJobIn$=qs.BatchJobIn$outboundSchema=qs.BatchJobIn$inboundSchema=void 0;qs.batchJobInToJSON=x8r;qs.batchJobInFromJSON=C8r;var cd=w8r(ge()),Pxt=Ee(),S8r=de(),Txt=LOe();qs.BatchJobIn$inboundSchema=cd.object({input_files:cd.array(cd.string()),endpoint:Txt.ApiEndpoint$inboundSchema,model:cd.string(),metadata:cd.nullable(cd.record(cd.string())).optional(),timeout_hours:cd.number().int().default(24)}).transform(t=>(0,Pxt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));qs.BatchJobIn$outboundSchema=cd.object({inputFiles:cd.array(cd.string()),endpoint:Txt.ApiEndpoint$outboundSchema,model:cd.string(),metadata:cd.nullable(cd.record(cd.string())).optional(),timeoutHours:cd.number().int().default(24)}).transform(t=>(0,Pxt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var Ext;(function(t){t.inboundSchema=qs.BatchJobIn$inboundSchema,t.outboundSchema=qs.BatchJobIn$outboundSchema})(Ext||(qs.BatchJobIn$=Ext={}));function x8r(t){return JSON.stringify(qs.BatchJobIn$outboundSchema.parse(t))}function C8r(t){return(0,S8r.safeParse)(t,e=>qs.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var BOe=b(Us=>{"use strict";var O8r=Us&&Us.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E8r=Us&&Us.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P8r=Us&&Us.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&O8r(e,t,r);return E8r(e,t),e};Object.defineProperty(Us,"__esModule",{value:!0});Us.BatchJobStatus$=Us.BatchJobStatus$outboundSchema=Us.BatchJobStatus$inboundSchema=Us.BatchJobStatus=void 0;var T8r=P8r(ge());Us.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Us.BatchJobStatus$inboundSchema=T8r.nativeEnum(Us.BatchJobStatus);Us.BatchJobStatus$outboundSchema=Us.BatchJobStatus$inboundSchema;var Axt;(function(t){t.inboundSchema=Us.BatchJobStatus$inboundSchema,t.outboundSchema=Us.BatchJobStatus$outboundSchema})(Axt||(Us.BatchJobStatus$=Axt={}))});var $Oe=b(Yn=>{"use strict";var M8r=Yn&&Yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A8r=Yn&&Yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R8r=Yn&&Yn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M8r(e,t,r);return A8r(e,t),e};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.BatchJobOut$=Yn.BatchJobOut$outboundSchema=Yn.BatchJobOut$inboundSchema=Yn.BatchJobOutObject$=Yn.BatchJobOutObject$outboundSchema=Yn.BatchJobOutObject$inboundSchema=Yn.BatchJobOutObject=void 0;Yn.batchJobOutToJSON=D8r;Yn.batchJobOutFromJSON=j8r;var $t=R8r(ge()),Dxt=Ee(),I8r=de(),jxt=kOe(),Nxt=BOe();Yn.BatchJobOutObject={Batch:"batch"};Yn.BatchJobOutObject$inboundSchema=$t.nativeEnum(Yn.BatchJobOutObject);Yn.BatchJobOutObject$outboundSchema=Yn.BatchJobOutObject$inboundSchema;var Rxt;(function(t){t.inboundSchema=Yn.BatchJobOutObject$inboundSchema,t.outboundSchema=Yn.BatchJobOutObject$outboundSchema})(Rxt||(Yn.BatchJobOutObject$=Rxt={}));Yn.BatchJobOut$inboundSchema=$t.object({id:$t.string(),object:$t.literal("batch").default("batch"),input_files:$t.array($t.string()),metadata:$t.nullable($t.record($t.any())).optional(),endpoint:$t.string(),model:$t.string(),output_file:$t.nullable($t.string()).optional(),error_file:$t.nullable($t.string()).optional(),errors:$t.array(jxt.BatchError$inboundSchema),status:Nxt.BatchJobStatus$inboundSchema,created_at:$t.number().int(),total_requests:$t.number().int(),completed_requests:$t.number().int(),succeeded_requests:$t.number().int(),failed_requests:$t.number().int(),started_at:$t.nullable($t.number().int()).optional(),completed_at:$t.nullable($t.number().int()).optional()}).transform(t=>(0,Dxt.remap)(t,{input_files:"inputFiles",output_file:"outputFile",error_file:"errorFile",created_at:"createdAt",total_requests:"totalRequests",completed_requests:"completedRequests",succeeded_requests:"succeededRequests",failed_requests:"failedRequests",started_at:"startedAt",completed_at:"completedAt"}));Yn.BatchJobOut$outboundSchema=$t.object({id:$t.string(),object:$t.literal("batch").default("batch"),inputFiles:$t.array($t.string()),metadata:$t.nullable($t.record($t.any())).optional(),endpoint:$t.string(),model:$t.string(),outputFile:$t.nullable($t.string()).optional(),errorFile:$t.nullable($t.string()).optional(),errors:$t.array(jxt.BatchError$outboundSchema),status:Nxt.BatchJobStatus$outboundSchema,createdAt:$t.number().int(),totalRequests:$t.number().int(),completedRequests:$t.number().int(),succeededRequests:$t.number().int(),failedRequests:$t.number().int(),startedAt:$t.nullable($t.number().int()).optional(),completedAt:$t.nullable($t.number().int()).optional()}).transform(t=>(0,Dxt.remap)(t,{inputFiles:"input_files",outputFile:"output_file",errorFile:"error_file",createdAt:"created_at",totalRequests:"total_requests",completedRequests:"completed_requests",succeededRequests:"succeeded_requests",failedRequests:"failed_requests",startedAt:"started_at",completedAt:"completed_at"}));var Ixt;(function(t){t.inboundSchema=Yn.BatchJobOut$inboundSchema,t.outboundSchema=Yn.BatchJobOut$outboundSchema})(Ixt||(Yn.BatchJobOut$=Ixt={}));function D8r(t){return JSON.stringify(Yn.BatchJobOut$outboundSchema.parse(t))}function j8r(t){return(0,I8r.safeParse)(t,e=>Yn.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var Bxt=b(Xn=>{"use strict";var N8r=Xn&&Xn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L8r=Xn&&Xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F8r=Xn&&Xn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N8r(e,t,r);return L8r(e,t),e};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.BatchJobsOut$=Xn.BatchJobsOut$outboundSchema=Xn.BatchJobsOut$inboundSchema=Xn.BatchJobsOutObject$=Xn.BatchJobsOutObject$outboundSchema=Xn.BatchJobsOutObject$inboundSchema=Xn.BatchJobsOutObject=void 0;Xn.batchJobsOutToJSON=B8r;Xn.batchJobsOutFromJSON=$8r;var LC=F8r(ge()),k8r=de(),kxt=$Oe();Xn.BatchJobsOutObject={List:"list"};Xn.BatchJobsOutObject$inboundSchema=LC.nativeEnum(Xn.BatchJobsOutObject);Xn.BatchJobsOutObject$outboundSchema=Xn.BatchJobsOutObject$inboundSchema;var Lxt;(function(t){t.inboundSchema=Xn.BatchJobsOutObject$inboundSchema,t.outboundSchema=Xn.BatchJobsOutObject$outboundSchema})(Lxt||(Xn.BatchJobsOutObject$=Lxt={}));Xn.BatchJobsOut$inboundSchema=LC.object({data:LC.array(kxt.BatchJobOut$inboundSchema).optional(),object:LC.literal("list").default("list"),total:LC.number().int()});Xn.BatchJobsOut$outboundSchema=LC.object({data:LC.array(kxt.BatchJobOut$outboundSchema).optional(),object:LC.literal("list").default("list"),total:LC.number().int()});var Fxt;(function(t){t.inboundSchema=Xn.BatchJobsOut$inboundSchema,t.outboundSchema=Xn.BatchJobsOut$outboundSchema})(Fxt||(Xn.BatchJobsOut$=Fxt={}));function B8r(t){return JSON.stringify(Xn.BatchJobsOut$outboundSchema.parse(t))}function $8r(t){return(0,k8r.safeParse)(t,e=>Xn.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Vxt=b(Pt=>{"use strict";var q8r=Pt&&Pt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U8r=Pt&&Pt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z8r=Pt&&Pt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q8r(e,t,r);return U8r(e,t),e};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=H8r;Pt.twoFromJSON=V8r;Pt.oneToJSON=W8r;Pt.oneFromJSON=J8r;Pt.chatClassificationRequestInputsToJSON=G8r;Pt.chatClassificationRequestInputsFromJSON=K8r;Pt.chatClassificationRequestToJSON=Y8r;Pt.chatClassificationRequestFromJSON=X8r;var ue=z8r(ge()),Hxt=Ee(),xte=de(),sm=IT(),um=iD(),lm=aD(),cm=sD();Pt.Two$inboundSchema=ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))]);Pt.Two$outboundSchema=ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))]);var $xt;(function(t){t.inboundSchema=Pt.Two$inboundSchema,t.outboundSchema=Pt.Two$outboundSchema})($xt||(Pt.Two$=$xt={}));function H8r(t){return JSON.stringify(Pt.Two$outboundSchema.parse(t))}function V8r(t){return(0,xte.safeParse)(t,e=>Pt.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Pt.One$inboundSchema=ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))]);Pt.One$outboundSchema=ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))]);var qxt;(function(t){t.inboundSchema=Pt.One$inboundSchema,t.outboundSchema=Pt.One$outboundSchema})(qxt||(Pt.One$=qxt={}));function W8r(t){return JSON.stringify(Pt.One$outboundSchema.parse(t))}function J8r(t){return(0,xte.safeParse)(t,e=>Pt.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Pt.ChatClassificationRequestInputs$inboundSchema=ue.union([ue.array(ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])),ue.array(ue.array(ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])))]);Pt.ChatClassificationRequestInputs$outboundSchema=ue.union([ue.array(ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])),ue.array(ue.array(ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])))]);var Uxt;(function(t){t.inboundSchema=Pt.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Pt.ChatClassificationRequestInputs$outboundSchema})(Uxt||(Pt.ChatClassificationRequestInputs$=Uxt={}));function G8r(t){return JSON.stringify(Pt.ChatClassificationRequestInputs$outboundSchema.parse(t))}function K8r(t){return(0,xte.safeParse)(t,e=>Pt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Pt.ChatClassificationRequest$inboundSchema=ue.object({input:ue.union([ue.array(ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])),ue.array(ue.array(ue.union([um.SystemMessage$inboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$inboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$inboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$inboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ue.nullable(ue.string())}).transform(t=>(0,Hxt.remap)(t,{input:"inputs"}));Pt.ChatClassificationRequest$outboundSchema=ue.object({inputs:ue.union([ue.array(ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])),ue.array(ue.array(ue.union([um.SystemMessage$outboundSchema.and(ue.object({role:ue.literal("system")}).transform(t=>({role:t.role}))),cm.UserMessage$outboundSchema.and(ue.object({role:ue.literal("user")}).transform(t=>({role:t.role}))),sm.AssistantMessage$outboundSchema.and(ue.object({role:ue.literal("assistant")}).transform(t=>({role:t.role}))),lm.ToolMessage$outboundSchema.and(ue.object({role:ue.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ue.nullable(ue.string())}).transform(t=>(0,Hxt.remap)(t,{inputs:"input"}));var zxt;(function(t){t.inboundSchema=Pt.ChatClassificationRequest$inboundSchema,t.outboundSchema=Pt.ChatClassificationRequest$outboundSchema})(zxt||(Pt.ChatClassificationRequest$=zxt={}));function Y8r(t){return JSON.stringify(Pt.ChatClassificationRequest$outboundSchema.parse(t))}function X8r(t){return(0,xte.safeParse)(t,e=>Pt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Cte=b(An=>{"use strict";var Z8r=An&&An.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q8r=An&&An.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eHr=An&&An.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z8r(e,t,r);return Q8r(e,t),e};Object.defineProperty(An,"__esModule",{value:!0});An.ChatCompletionChoice$=An.ChatCompletionChoice$outboundSchema=An.ChatCompletionChoice$inboundSchema=An.FinishReason$=An.FinishReason$outboundSchema=An.FinishReason$inboundSchema=An.FinishReason=void 0;An.chatCompletionChoiceToJSON=nHr;An.chatCompletionChoiceFromJSON=oHr;var Wg=eHr(ge()),Gxt=Ee(),tHr=de(),rHr=RT(),Kxt=IT();An.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};An.FinishReason$inboundSchema=Wg.union([Wg.nativeEnum(An.FinishReason),Wg.string().transform(rHr.catchUnrecognizedEnum)]);An.FinishReason$outboundSchema=Wg.union([Wg.nativeEnum(An.FinishReason),Wg.string().and(Wg.custom())]);var Wxt;(function(t){t.inboundSchema=An.FinishReason$inboundSchema,t.outboundSchema=An.FinishReason$outboundSchema})(Wxt||(An.FinishReason$=Wxt={}));An.ChatCompletionChoice$inboundSchema=Wg.object({index:Wg.number().int(),message:Kxt.AssistantMessage$inboundSchema,finish_reason:An.FinishReason$inboundSchema}).transform(t=>(0,Gxt.remap)(t,{finish_reason:"finishReason"}));An.ChatCompletionChoice$outboundSchema=Wg.object({index:Wg.number().int(),message:Kxt.AssistantMessage$outboundSchema,finishReason:An.FinishReason$outboundSchema}).transform(t=>(0,Gxt.remap)(t,{finishReason:"finish_reason"}));var Jxt;(function(t){t.inboundSchema=An.ChatCompletionChoice$inboundSchema,t.outboundSchema=An.ChatCompletionChoice$outboundSchema})(Jxt||(An.ChatCompletionChoice$=Jxt={}));function nHr(t){return JSON.stringify(An.ChatCompletionChoice$outboundSchema.parse(t))}function oHr(t){return(0,tHr.safeParse)(t,e=>An.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var oCt=b(Tt=>{"use strict";var iHr=Tt&&Tt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aHr=Tt&&Tt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sHr=Tt&&Tt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iHr(e,t,r);return aHr(e,t),e};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=uHr;Tt.stopFromJSON=lHr;Tt.messagesToJSON=cHr;Tt.messagesFromJSON=dHr;Tt.chatCompletionRequestToolChoiceToJSON=fHr;Tt.chatCompletionRequestToolChoiceFromJSON=pHr;Tt.chatCompletionRequestToJSON=hHr;Tt.chatCompletionRequestFromJSON=mHr;var xe=sHr(ge()),eCt=Ee(),Ote=de(),Ete=IT(),tCt=NB(),rCt=LB(),Pte=iD(),nCt=FB(),Tte=kB(),Mte=BB(),Ate=aD(),Rte=sD();Tt.Stop$inboundSchema=xe.union([xe.string(),xe.array(xe.string())]);Tt.Stop$outboundSchema=xe.union([xe.string(),xe.array(xe.string())]);var Yxt;(function(t){t.inboundSchema=Tt.Stop$inboundSchema,t.outboundSchema=Tt.Stop$outboundSchema})(Yxt||(Tt.Stop$=Yxt={}));function uHr(t){return JSON.stringify(Tt.Stop$outboundSchema.parse(t))}function lHr(t){return(0,Ote.safeParse)(t,e=>Tt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Tt.Messages$inboundSchema=xe.union([Pte.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Rte.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ete.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Ate.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);Tt.Messages$outboundSchema=xe.union([Pte.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Rte.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ete.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Ate.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);var Xxt;(function(t){t.inboundSchema=Tt.Messages$inboundSchema,t.outboundSchema=Tt.Messages$outboundSchema})(Xxt||(Tt.Messages$=Xxt={}));function cHr(t){return JSON.stringify(Tt.Messages$outboundSchema.parse(t))}function dHr(t){return(0,Ote.safeParse)(t,e=>Tt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Tt.ChatCompletionRequestToolChoice$inboundSchema=xe.union([Tte.ToolChoice$inboundSchema,Mte.ToolChoiceEnum$inboundSchema]);Tt.ChatCompletionRequestToolChoice$outboundSchema=xe.union([Tte.ToolChoice$outboundSchema,Mte.ToolChoiceEnum$outboundSchema]);var Zxt;(function(t){t.inboundSchema=Tt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Tt.ChatCompletionRequestToolChoice$outboundSchema})(Zxt||(Tt.ChatCompletionRequestToolChoice$=Zxt={}));function fHr(t){return JSON.stringify(Tt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function pHr(t){return(0,Ote.safeParse)(t,e=>Tt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Tt.ChatCompletionRequest$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(!1),stop:xe.union([xe.string(),xe.array(xe.string())]).optional(),random_seed:xe.nullable(xe.number().int()).optional(),messages:xe.array(xe.union([Pte.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Rte.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ete.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Ate.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:rCt.ResponseFormat$inboundSchema.optional(),tools:xe.nullable(xe.array(nCt.Tool$inboundSchema)).optional(),tool_choice:xe.union([Tte.ToolChoice$inboundSchema,Mte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:xe.number().optional(),frequency_penalty:xe.number().optional(),n:xe.nullable(xe.number().int()).optional(),prediction:tCt.Prediction$inboundSchema.optional(),safe_prompt:xe.boolean().optional()}).transform(t=>(0,eCt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));Tt.ChatCompletionRequest$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(!1),stop:xe.union([xe.string(),xe.array(xe.string())]).optional(),randomSeed:xe.nullable(xe.number().int()).optional(),messages:xe.array(xe.union([Pte.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Rte.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ete.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Ate.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:rCt.ResponseFormat$outboundSchema.optional(),tools:xe.nullable(xe.array(nCt.Tool$outboundSchema)).optional(),toolChoice:xe.union([Tte.ToolChoice$outboundSchema,Mte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:xe.number().optional(),frequencyPenalty:xe.number().optional(),n:xe.nullable(xe.number().int()).optional(),prediction:tCt.Prediction$outboundSchema.optional(),safePrompt:xe.boolean().optional()}).transform(t=>(0,eCt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var Qxt;(function(t){t.inboundSchema=Tt.ChatCompletionRequest$inboundSchema,t.outboundSchema=Tt.ChatCompletionRequest$outboundSchema})(Qxt||(Tt.ChatCompletionRequest$=Qxt={}));function hHr(t){return JSON.stringify(Tt.ChatCompletionRequest$outboundSchema.parse(t))}function mHr(t){return(0,Ote.safeParse)(t,e=>Tt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var qB=b(zs=>{"use strict";var gHr=zs&&zs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yHr=zs&&zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHr=zs&&zs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gHr(e,t,r);return yHr(e,t),e};Object.defineProperty(zs,"__esModule",{value:!0});zs.UsageInfo$=zs.UsageInfo$outboundSchema=zs.UsageInfo$inboundSchema=void 0;zs.usageInfoToJSON=vHr;zs.usageInfoFromJSON=wHr;var DT=bHr(ge()),aCt=Ee(),_Hr=de();zs.UsageInfo$inboundSchema=DT.object({prompt_tokens:DT.number().int(),completion_tokens:DT.number().int(),total_tokens:DT.number().int()}).transform(t=>(0,aCt.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));zs.UsageInfo$outboundSchema=DT.object({promptTokens:DT.number().int(),completionTokens:DT.number().int(),totalTokens:DT.number().int()}).transform(t=>(0,aCt.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var iCt;(function(t){t.inboundSchema=zs.UsageInfo$inboundSchema,t.outboundSchema=zs.UsageInfo$outboundSchema})(iCt||(zs.UsageInfo$=iCt={}));function vHr(t){return JSON.stringify(zs.UsageInfo$outboundSchema.parse(t))}function wHr(t){return(0,_Hr.safeParse)(t,e=>zs.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var cCt=b(Hs=>{"use strict";var SHr=Hs&&Hs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xHr=Hs&&Hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CHr=Hs&&Hs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SHr(e,t,r);return xHr(e,t),e};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.ChatCompletionResponse$=Hs.ChatCompletionResponse$outboundSchema=Hs.ChatCompletionResponse$inboundSchema=void 0;Hs.chatCompletionResponseToJSON=EHr;Hs.chatCompletionResponseFromJSON=PHr;var dm=CHr(ge()),OHr=de(),uCt=Cte(),lCt=qB();Hs.ChatCompletionResponse$inboundSchema=dm.object({id:dm.string(),object:dm.string(),model:dm.string(),usage:lCt.UsageInfo$inboundSchema,created:dm.number().int().optional(),choices:dm.array(uCt.ChatCompletionChoice$inboundSchema).optional()});Hs.ChatCompletionResponse$outboundSchema=dm.object({id:dm.string(),object:dm.string(),model:dm.string(),usage:lCt.UsageInfo$outboundSchema,created:dm.number().int().optional(),choices:dm.array(uCt.ChatCompletionChoice$outboundSchema).optional()});var sCt;(function(t){t.inboundSchema=Hs.ChatCompletionResponse$inboundSchema,t.outboundSchema=Hs.ChatCompletionResponse$outboundSchema})(sCt||(Hs.ChatCompletionResponse$=sCt={}));function EHr(t){return JSON.stringify(Hs.ChatCompletionResponse$outboundSchema.parse(t))}function PHr(t){return(0,OHr.safeParse)(t,e=>Hs.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var _Ct=b(Mt=>{"use strict";var THr=Mt&&Mt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MHr=Mt&&Mt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHr=Mt&&Mt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&THr(e,t,r);return MHr(e,t),e};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=RHr;Mt.chatCompletionStreamRequestStopFromJSON=IHr;Mt.chatCompletionStreamRequestMessagesToJSON=DHr;Mt.chatCompletionStreamRequestMessagesFromJSON=jHr;Mt.chatCompletionStreamRequestToolChoiceToJSON=NHr;Mt.chatCompletionStreamRequestToolChoiceFromJSON=LHr;Mt.chatCompletionStreamRequestToJSON=FHr;Mt.chatCompletionStreamRequestFromJSON=kHr;var Ce=AHr(ge()),mCt=Ee(),Ite=de(),Dte=IT(),gCt=NB(),yCt=LB(),jte=iD(),bCt=FB(),Nte=kB(),Lte=BB(),Fte=aD(),kte=sD();Mt.ChatCompletionStreamRequestStop$inboundSchema=Ce.union([Ce.string(),Ce.array(Ce.string())]);Mt.ChatCompletionStreamRequestStop$outboundSchema=Ce.union([Ce.string(),Ce.array(Ce.string())]);var dCt;(function(t){t.inboundSchema=Mt.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Mt.ChatCompletionStreamRequestStop$outboundSchema})(dCt||(Mt.ChatCompletionStreamRequestStop$=dCt={}));function RHr(t){return JSON.stringify(Mt.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function IHr(t){return(0,Ite.safeParse)(t,e=>Mt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Mt.ChatCompletionStreamRequestMessages$inboundSchema=Ce.union([jte.SystemMessage$inboundSchema.and(Ce.object({role:Ce.literal("system")}).transform(t=>({role:t.role}))),kte.UserMessage$inboundSchema.and(Ce.object({role:Ce.literal("user")}).transform(t=>({role:t.role}))),Dte.AssistantMessage$inboundSchema.and(Ce.object({role:Ce.literal("assistant")}).transform(t=>({role:t.role}))),Fte.ToolMessage$inboundSchema.and(Ce.object({role:Ce.literal("tool")}).transform(t=>({role:t.role})))]);Mt.ChatCompletionStreamRequestMessages$outboundSchema=Ce.union([jte.SystemMessage$outboundSchema.and(Ce.object({role:Ce.literal("system")}).transform(t=>({role:t.role}))),kte.UserMessage$outboundSchema.and(Ce.object({role:Ce.literal("user")}).transform(t=>({role:t.role}))),Dte.AssistantMessage$outboundSchema.and(Ce.object({role:Ce.literal("assistant")}).transform(t=>({role:t.role}))),Fte.ToolMessage$outboundSchema.and(Ce.object({role:Ce.literal("tool")}).transform(t=>({role:t.role})))]);var fCt;(function(t){t.inboundSchema=Mt.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Mt.ChatCompletionStreamRequestMessages$outboundSchema})(fCt||(Mt.ChatCompletionStreamRequestMessages$=fCt={}));function DHr(t){return JSON.stringify(Mt.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function jHr(t){return(0,Ite.safeParse)(t,e=>Mt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Mt.ChatCompletionStreamRequestToolChoice$inboundSchema=Ce.union([Nte.ToolChoice$inboundSchema,Lte.ToolChoiceEnum$inboundSchema]);Mt.ChatCompletionStreamRequestToolChoice$outboundSchema=Ce.union([Nte.ToolChoice$outboundSchema,Lte.ToolChoiceEnum$outboundSchema]);var pCt;(function(t){t.inboundSchema=Mt.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Mt.ChatCompletionStreamRequestToolChoice$outboundSchema})(pCt||(Mt.ChatCompletionStreamRequestToolChoice$=pCt={}));function NHr(t){return JSON.stringify(Mt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function LHr(t){return(0,Ite.safeParse)(t,e=>Mt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Mt.ChatCompletionStreamRequest$inboundSchema=Ce.object({model:Ce.nullable(Ce.string()),temperature:Ce.nullable(Ce.number()).optional(),top_p:Ce.number().optional(),max_tokens:Ce.nullable(Ce.number().int()).optional(),stream:Ce.boolean().default(!0),stop:Ce.union([Ce.string(),Ce.array(Ce.string())]).optional(),random_seed:Ce.nullable(Ce.number().int()).optional(),messages:Ce.array(Ce.union([jte.SystemMessage$inboundSchema.and(Ce.object({role:Ce.literal("system")}).transform(t=>({role:t.role}))),kte.UserMessage$inboundSchema.and(Ce.object({role:Ce.literal("user")}).transform(t=>({role:t.role}))),Dte.AssistantMessage$inboundSchema.and(Ce.object({role:Ce.literal("assistant")}).transform(t=>({role:t.role}))),Fte.ToolMessage$inboundSchema.and(Ce.object({role:Ce.literal("tool")}).transform(t=>({role:t.role})))])),response_format:yCt.ResponseFormat$inboundSchema.optional(),tools:Ce.nullable(Ce.array(bCt.Tool$inboundSchema)).optional(),tool_choice:Ce.union([Nte.ToolChoice$inboundSchema,Lte.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ce.number().optional(),frequency_penalty:Ce.number().optional(),n:Ce.nullable(Ce.number().int()).optional(),prediction:gCt.Prediction$inboundSchema.optional(),safe_prompt:Ce.boolean().optional()}).transform(t=>(0,mCt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));Mt.ChatCompletionStreamRequest$outboundSchema=Ce.object({model:Ce.nullable(Ce.string()),temperature:Ce.nullable(Ce.number()).optional(),topP:Ce.number().optional(),maxTokens:Ce.nullable(Ce.number().int()).optional(),stream:Ce.boolean().default(!0),stop:Ce.union([Ce.string(),Ce.array(Ce.string())]).optional(),randomSeed:Ce.nullable(Ce.number().int()).optional(),messages:Ce.array(Ce.union([jte.SystemMessage$outboundSchema.and(Ce.object({role:Ce.literal("system")}).transform(t=>({role:t.role}))),kte.UserMessage$outboundSchema.and(Ce.object({role:Ce.literal("user")}).transform(t=>({role:t.role}))),Dte.AssistantMessage$outboundSchema.and(Ce.object({role:Ce.literal("assistant")}).transform(t=>({role:t.role}))),Fte.ToolMessage$outboundSchema.and(Ce.object({role:Ce.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:yCt.ResponseFormat$outboundSchema.optional(),tools:Ce.nullable(Ce.array(bCt.Tool$outboundSchema)).optional(),toolChoice:Ce.union([Nte.ToolChoice$outboundSchema,Lte.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ce.number().optional(),frequencyPenalty:Ce.number().optional(),n:Ce.nullable(Ce.number().int()).optional(),prediction:gCt.Prediction$outboundSchema.optional(),safePrompt:Ce.boolean().optional()}).transform(t=>(0,mCt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var hCt;(function(t){t.inboundSchema=Mt.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Mt.ChatCompletionStreamRequest$outboundSchema})(hCt||(Mt.ChatCompletionStreamRequest$=hCt={}));function FHr(t){return JSON.stringify(Mt.ChatCompletionStreamRequest$outboundSchema.parse(t))}function kHr(t){return(0,Ite.safeParse)(t,e=>Mt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var qOe=b(Vs=>{"use strict";var BHr=Vs&&Vs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Hr=Vs&&Vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHr=Vs&&Vs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BHr(e,t,r);return $Hr(e,t),e};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.MetricOut$=Vs.MetricOut$outboundSchema=Vs.MetricOut$inboundSchema=void 0;Vs.metricOutToJSON=zHr;Vs.metricOutFromJSON=HHr;var Wf=qHr(ge()),wCt=Ee(),UHr=de();Vs.MetricOut$inboundSchema=Wf.object({train_loss:Wf.nullable(Wf.number()).optional(),valid_loss:Wf.nullable(Wf.number()).optional(),valid_mean_token_accuracy:Wf.nullable(Wf.number()).optional()}).transform(t=>(0,wCt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Vs.MetricOut$outboundSchema=Wf.object({trainLoss:Wf.nullable(Wf.number()).optional(),validLoss:Wf.nullable(Wf.number()).optional(),validMeanTokenAccuracy:Wf.nullable(Wf.number()).optional()}).transform(t=>(0,wCt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var vCt;(function(t){t.inboundSchema=Vs.MetricOut$inboundSchema,t.outboundSchema=Vs.MetricOut$outboundSchema})(vCt||(Vs.MetricOut$=vCt={}));function zHr(t){return JSON.stringify(Vs.MetricOut$outboundSchema.parse(t))}function HHr(t){return(0,UHr.safeParse)(t,e=>Vs.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var UOe=b(Ws=>{"use strict";var VHr=Ws&&Ws.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WHr=Ws&&Ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JHr=Ws&&Ws.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VHr(e,t,r);return WHr(e,t),e};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.CheckpointOut$=Ws.CheckpointOut$outboundSchema=Ws.CheckpointOut$inboundSchema=void 0;Ws.checkpointOutToJSON=KHr;Ws.checkpointOutFromJSON=YHr;var UB=JHr(ge()),xCt=Ee(),GHr=de(),CCt=qOe();Ws.CheckpointOut$inboundSchema=UB.object({metrics:CCt.MetricOut$inboundSchema,step_number:UB.number().int(),created_at:UB.number().int()}).transform(t=>(0,xCt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));Ws.CheckpointOut$outboundSchema=UB.object({metrics:CCt.MetricOut$outboundSchema,stepNumber:UB.number().int(),createdAt:UB.number().int()}).transform(t=>(0,xCt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var SCt;(function(t){t.inboundSchema=Ws.CheckpointOut$inboundSchema,t.outboundSchema=Ws.CheckpointOut$outboundSchema})(SCt||(Ws.CheckpointOut$=SCt={}));function KHr(t){return JSON.stringify(Ws.CheckpointOut$outboundSchema.parse(t))}function YHr(t){return(0,GHr.safeParse)(t,e=>Ws.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var zOe=b(Js=>{"use strict";var XHr=Js&&Js.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZHr=Js&&Js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QHr=Js&&Js.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XHr(e,t,r);return ZHr(e,t),e};Object.defineProperty(Js,"__esModule",{value:!0});Js.ClassificationObject$=Js.ClassificationObject$outboundSchema=Js.ClassificationObject$inboundSchema=void 0;Js.classificationObjectToJSON=t6r;Js.classificationObjectFromJSON=r6r;var hS=QHr(ge()),ECt=Ee(),e6r=de();Js.ClassificationObject$inboundSchema=hS.object({categories:hS.record(hS.boolean()).optional(),category_scores:hS.record(hS.number()).optional()}).transform(t=>(0,ECt.remap)(t,{category_scores:"categoryScores"}));Js.ClassificationObject$outboundSchema=hS.object({categories:hS.record(hS.boolean()).optional(),categoryScores:hS.record(hS.number()).optional()}).transform(t=>(0,ECt.remap)(t,{categoryScores:"category_scores"}));var OCt;(function(t){t.inboundSchema=Js.ClassificationObject$inboundSchema,t.outboundSchema=Js.ClassificationObject$outboundSchema})(OCt||(Js.ClassificationObject$=OCt={}));function t6r(t){return JSON.stringify(Js.ClassificationObject$outboundSchema.parse(t))}function r6r(t){return(0,e6r.safeParse)(t,e=>Js.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var RCt=b(Zn=>{"use strict";var n6r=Zn&&Zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o6r=Zn&&Zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i6r=Zn&&Zn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n6r(e,t,r);return o6r(e,t),e};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=a6r;Zn.classificationRequestInputsFromJSON=s6r;Zn.classificationRequestToJSON=u6r;Zn.classificationRequestFromJSON=l6r;var Wa=i6r(ge()),MCt=Ee(),ACt=de();Zn.ClassificationRequestInputs$inboundSchema=Wa.union([Wa.string(),Wa.array(Wa.string())]);Zn.ClassificationRequestInputs$outboundSchema=Wa.union([Wa.string(),Wa.array(Wa.string())]);var PCt;(function(t){t.inboundSchema=Zn.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Zn.ClassificationRequestInputs$outboundSchema})(PCt||(Zn.ClassificationRequestInputs$=PCt={}));function a6r(t){return JSON.stringify(Zn.ClassificationRequestInputs$outboundSchema.parse(t))}function s6r(t){return(0,ACt.safeParse)(t,e=>Zn.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Zn.ClassificationRequest$inboundSchema=Wa.object({input:Wa.union([Wa.string(),Wa.array(Wa.string())]),model:Wa.nullable(Wa.string()).optional()}).transform(t=>(0,MCt.remap)(t,{input:"inputs"}));Zn.ClassificationRequest$outboundSchema=Wa.object({inputs:Wa.union([Wa.string(),Wa.array(Wa.string())]),model:Wa.nullable(Wa.string()).optional()}).transform(t=>(0,MCt.remap)(t,{inputs:"input"}));var TCt;(function(t){t.inboundSchema=Zn.ClassificationRequest$inboundSchema,t.outboundSchema=Zn.ClassificationRequest$outboundSchema})(TCt||(Zn.ClassificationRequest$=TCt={}));function u6r(t){return JSON.stringify(Zn.ClassificationRequest$outboundSchema.parse(t))}function l6r(t){return(0,ACt.safeParse)(t,e=>Zn.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var jCt=b(Gs=>{"use strict";var c6r=Gs&&Gs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d6r=Gs&&Gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f6r=Gs&&Gs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c6r(e,t,r);return d6r(e,t),e};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.ClassificationResponse$=Gs.ClassificationResponse$outboundSchema=Gs.ClassificationResponse$inboundSchema=void 0;Gs.classificationResponseToJSON=h6r;Gs.classificationResponseFromJSON=m6r;var jT=f6r(ge()),p6r=de(),DCt=zOe();Gs.ClassificationResponse$inboundSchema=jT.object({id:jT.string().optional(),model:jT.string().optional(),results:jT.array(DCt.ClassificationObject$inboundSchema).optional()});Gs.ClassificationResponse$outboundSchema=jT.object({id:jT.string().optional(),model:jT.string().optional(),results:jT.array(DCt.ClassificationObject$outboundSchema).optional()});var ICt;(function(t){t.inboundSchema=Gs.ClassificationResponse$inboundSchema,t.outboundSchema=Gs.ClassificationResponse$outboundSchema})(ICt||(Gs.ClassificationResponse$=ICt={}));function h6r(t){return JSON.stringify(Gs.ClassificationResponse$outboundSchema.parse(t))}function m6r(t){return(0,p6r.safeParse)(t,e=>Gs.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var HOe=b(Qn=>{"use strict";var g6r=Qn&&Qn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y6r=Qn&&Qn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b6r=Qn&&Qn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g6r(e,t,r);return y6r(e,t),e};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.DeltaMessage$=Qn.DeltaMessage$outboundSchema=Qn.DeltaMessage$inboundSchema=Qn.Content$=Qn.Content$outboundSchema=Qn.Content$inboundSchema=void 0;Qn.contentToJSON=_6r;Qn.contentFromJSON=v6r;Qn.deltaMessageToJSON=w6r;Qn.deltaMessageFromJSON=S6r;var Yi=b6r(ge()),FCt=Ee(),kCt=de(),Bte=DB(),BCt=tte();Qn.Content$inboundSchema=Yi.union([Yi.string(),Yi.array(Bte.ContentChunk$inboundSchema)]);Qn.Content$outboundSchema=Yi.union([Yi.string(),Yi.array(Bte.ContentChunk$outboundSchema)]);var NCt;(function(t){t.inboundSchema=Qn.Content$inboundSchema,t.outboundSchema=Qn.Content$outboundSchema})(NCt||(Qn.Content$=NCt={}));function _6r(t){return JSON.stringify(Qn.Content$outboundSchema.parse(t))}function v6r(t){return(0,kCt.safeParse)(t,e=>Qn.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Qn.DeltaMessage$inboundSchema=Yi.object({role:Yi.nullable(Yi.string()).optional(),content:Yi.nullable(Yi.union([Yi.string(),Yi.array(Bte.ContentChunk$inboundSchema)])).optional(),tool_calls:Yi.nullable(Yi.array(BCt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,FCt.remap)(t,{tool_calls:"toolCalls"}));Qn.DeltaMessage$outboundSchema=Yi.object({role:Yi.nullable(Yi.string()).optional(),content:Yi.nullable(Yi.union([Yi.string(),Yi.array(Bte.ContentChunk$outboundSchema)])).optional(),toolCalls:Yi.nullable(Yi.array(BCt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,FCt.remap)(t,{toolCalls:"tool_calls"}));var LCt;(function(t){t.inboundSchema=Qn.DeltaMessage$inboundSchema,t.outboundSchema=Qn.DeltaMessage$outboundSchema})(LCt||(Qn.DeltaMessage$=LCt={}));function w6r(t){return JSON.stringify(Qn.DeltaMessage$outboundSchema.parse(t))}function S6r(t){return(0,kCt.safeParse)(t,e=>Qn.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var VOe=b(Rn=>{"use strict";var x6r=Rn&&Rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C6r=Rn&&Rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O6r=Rn&&Rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x6r(e,t,r);return C6r(e,t),e};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.CompletionResponseStreamChoice$=Rn.CompletionResponseStreamChoice$outboundSchema=Rn.CompletionResponseStreamChoice$inboundSchema=Rn.CompletionResponseStreamChoiceFinishReason$=Rn.CompletionResponseStreamChoiceFinishReason$outboundSchema=Rn.CompletionResponseStreamChoiceFinishReason$inboundSchema=Rn.CompletionResponseStreamChoiceFinishReason=void 0;Rn.completionResponseStreamChoiceToJSON=T6r;Rn.completionResponseStreamChoiceFromJSON=M6r;var Up=O6r(ge()),UCt=Ee(),E6r=de(),P6r=RT(),zCt=HOe();Rn.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Rn.CompletionResponseStreamChoiceFinishReason$inboundSchema=Up.union([Up.nativeEnum(Rn.CompletionResponseStreamChoiceFinishReason),Up.string().transform(P6r.catchUnrecognizedEnum)]);Rn.CompletionResponseStreamChoiceFinishReason$outboundSchema=Up.union([Up.nativeEnum(Rn.CompletionResponseStreamChoiceFinishReason),Up.string().and(Up.custom())]);var $Ct;(function(t){t.inboundSchema=Rn.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Rn.CompletionResponseStreamChoiceFinishReason$outboundSchema})($Ct||(Rn.CompletionResponseStreamChoiceFinishReason$=$Ct={}));Rn.CompletionResponseStreamChoice$inboundSchema=Up.object({index:Up.number().int(),delta:zCt.DeltaMessage$inboundSchema,finish_reason:Up.nullable(Rn.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,UCt.remap)(t,{finish_reason:"finishReason"}));Rn.CompletionResponseStreamChoice$outboundSchema=Up.object({index:Up.number().int(),delta:zCt.DeltaMessage$outboundSchema,finishReason:Up.nullable(Rn.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,UCt.remap)(t,{finishReason:"finish_reason"}));var qCt;(function(t){t.inboundSchema=Rn.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Rn.CompletionResponseStreamChoice$outboundSchema})(qCt||(Rn.CompletionResponseStreamChoice$=qCt={}));function T6r(t){return JSON.stringify(Rn.CompletionResponseStreamChoice$outboundSchema.parse(t))}function M6r(t){return(0,E6r.safeParse)(t,e=>Rn.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var WOe=b(Ks=>{"use strict";var A6r=Ks&&Ks.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R6r=Ks&&Ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I6r=Ks&&Ks.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A6r(e,t,r);return R6r(e,t),e};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.CompletionChunk$=Ks.CompletionChunk$outboundSchema=Ks.CompletionChunk$inboundSchema=void 0;Ks.completionChunkToJSON=j6r;Ks.completionChunkFromJSON=N6r;var fm=I6r(ge()),D6r=de(),VCt=VOe(),WCt=qB();Ks.CompletionChunk$inboundSchema=fm.object({id:fm.string(),object:fm.string().optional(),created:fm.number().int().optional(),model:fm.string(),usage:WCt.UsageInfo$inboundSchema.optional(),choices:fm.array(VCt.CompletionResponseStreamChoice$inboundSchema)});Ks.CompletionChunk$outboundSchema=fm.object({id:fm.string(),object:fm.string().optional(),created:fm.number().int().optional(),model:fm.string(),usage:WCt.UsageInfo$outboundSchema.optional(),choices:fm.array(VCt.CompletionResponseStreamChoice$outboundSchema)});var HCt;(function(t){t.inboundSchema=Ks.CompletionChunk$inboundSchema,t.outboundSchema=Ks.CompletionChunk$outboundSchema})(HCt||(Ks.CompletionChunk$=HCt={}));function j6r(t){return JSON.stringify(Ks.CompletionChunk$outboundSchema.parse(t))}function N6r(t){return(0,D6r.safeParse)(t,e=>Ks.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var KCt=b(Ys=>{"use strict";var L6r=Ys&&Ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F6r=Ys&&Ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k6r=Ys&&Ys.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L6r(e,t,r);return F6r(e,t),e};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.CompletionEvent$=Ys.CompletionEvent$outboundSchema=Ys.CompletionEvent$inboundSchema=void 0;Ys.completionEventToJSON=$6r;Ys.completionEventFromJSON=q6r;var S8=k6r(ge()),B6r=de(),GCt=WOe();Ys.CompletionEvent$inboundSchema=S8.object({data:S8.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:S8.ZodIssueCode.custom,message:`malformed json: ${r}`}),S8.NEVER}}).pipe(GCt.CompletionChunk$inboundSchema)});Ys.CompletionEvent$outboundSchema=S8.object({data:GCt.CompletionChunk$outboundSchema});var JCt;(function(t){t.inboundSchema=Ys.CompletionEvent$inboundSchema,t.outboundSchema=Ys.CompletionEvent$outboundSchema})(JCt||(Ys.CompletionEvent$=JCt={}));function $6r(t){return JSON.stringify(Ys.CompletionEvent$outboundSchema.parse(t))}function q6r(t){return(0,B6r.safeParse)(t,e=>Ys.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var XCt=b(Xs=>{"use strict";var U6r=Xs&&Xs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z6r=Xs&&Xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H6r=Xs&&Xs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U6r(e,t,r);return z6r(e,t),e};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.DeleteFileOut$=Xs.DeleteFileOut$outboundSchema=Xs.DeleteFileOut$inboundSchema=void 0;Xs.deleteFileOutToJSON=W6r;Xs.deleteFileOutFromJSON=J6r;var NT=H6r(ge()),V6r=de();Xs.DeleteFileOut$inboundSchema=NT.object({id:NT.string(),object:NT.string(),deleted:NT.boolean()});Xs.DeleteFileOut$outboundSchema=NT.object({id:NT.string(),object:NT.string(),deleted:NT.boolean()});var YCt;(function(t){t.inboundSchema=Xs.DeleteFileOut$inboundSchema,t.outboundSchema=Xs.DeleteFileOut$outboundSchema})(YCt||(Xs.DeleteFileOut$=YCt={}));function W6r(t){return JSON.stringify(Xs.DeleteFileOut$outboundSchema.parse(t))}function J6r(t){return(0,V6r.safeParse)(t,e=>Xs.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var QCt=b(Zs=>{"use strict";var G6r=Zs&&Zs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K6r=Zs&&Zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y6r=Zs&&Zs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G6r(e,t,r);return K6r(e,t),e};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.DeleteModelOut$=Zs.DeleteModelOut$outboundSchema=Zs.DeleteModelOut$inboundSchema=void 0;Zs.deleteModelOutToJSON=Z6r;Zs.deleteModelOutFromJSON=Q6r;var LT=Y6r(ge()),X6r=de();Zs.DeleteModelOut$inboundSchema=LT.object({id:LT.string(),object:LT.string().default("model"),deleted:LT.boolean().default(!0)});Zs.DeleteModelOut$outboundSchema=LT.object({id:LT.string(),object:LT.string().default("model"),deleted:LT.boolean().default(!0)});var ZCt;(function(t){t.inboundSchema=Zs.DeleteModelOut$inboundSchema,t.outboundSchema=Zs.DeleteModelOut$outboundSchema})(ZCt||(Zs.DeleteModelOut$=ZCt={}));function Z6r(t){return JSON.stringify(Zs.DeleteModelOut$outboundSchema.parse(t))}function Q6r(t){return(0,X6r.safeParse)(t,e=>Zs.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var JOe=b(Qs=>{"use strict";var eVr=Qs&&Qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tVr=Qs&&Qs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rVr=Qs&&Qs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eVr(e,t,r);return tVr(e,t),e};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.EventOut$=Qs.EventOut$outboundSchema=Qs.EventOut$inboundSchema=void 0;Qs.eventOutToJSON=oVr;Qs.eventOutFromJSON=iVr;var pm=rVr(ge()),tOt=Ee(),nVr=de();Qs.EventOut$inboundSchema=pm.object({name:pm.string(),data:pm.nullable(pm.record(pm.any())).optional(),created_at:pm.number().int()}).transform(t=>(0,tOt.remap)(t,{created_at:"createdAt"}));Qs.EventOut$outboundSchema=pm.object({name:pm.string(),data:pm.nullable(pm.record(pm.any())).optional(),createdAt:pm.number().int()}).transform(t=>(0,tOt.remap)(t,{createdAt:"created_at"}));var eOt;(function(t){t.inboundSchema=Qs.EventOut$inboundSchema,t.outboundSchema=Qs.EventOut$outboundSchema})(eOt||(Qs.EventOut$=eOt={}));function oVr(t){return JSON.stringify(Qs.EventOut$outboundSchema.parse(t))}function iVr(t){return(0,nVr.safeParse)(t,e=>Qs.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var $te=b(eo=>{"use strict";var aVr=eo&&eo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sVr=eo&&eo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uVr=eo&&eo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aVr(e,t,r);return sVr(e,t),e};Object.defineProperty(eo,"__esModule",{value:!0});eo.GithubRepositoryOut$=eo.GithubRepositoryOut$outboundSchema=eo.GithubRepositoryOut$inboundSchema=eo.GithubRepositoryOutType$=eo.GithubRepositoryOutType$outboundSchema=eo.GithubRepositoryOutType$inboundSchema=eo.GithubRepositoryOutType=void 0;eo.githubRepositoryOutToJSON=cVr;eo.githubRepositoryOutFromJSON=dVr;var _c=uVr(ge()),oOt=Ee(),lVr=de();eo.GithubRepositoryOutType={Github:"github"};eo.GithubRepositoryOutType$inboundSchema=_c.nativeEnum(eo.GithubRepositoryOutType);eo.GithubRepositoryOutType$outboundSchema=eo.GithubRepositoryOutType$inboundSchema;var rOt;(function(t){t.inboundSchema=eo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=eo.GithubRepositoryOutType$outboundSchema})(rOt||(eo.GithubRepositoryOutType$=rOt={}));eo.GithubRepositoryOut$inboundSchema=_c.object({type:_c.literal("github").default("github"),name:_c.string(),owner:_c.string(),ref:_c.nullable(_c.string()).optional(),weight:_c.number().default(1),commit_id:_c.string()}).transform(t=>(0,oOt.remap)(t,{commit_id:"commitId"}));eo.GithubRepositoryOut$outboundSchema=_c.object({type:_c.literal("github").default("github"),name:_c.string(),owner:_c.string(),ref:_c.nullable(_c.string()).optional(),weight:_c.number().default(1),commitId:_c.string()}).transform(t=>(0,oOt.remap)(t,{commitId:"commit_id"}));var nOt;(function(t){t.inboundSchema=eo.GithubRepositoryOut$inboundSchema,t.outboundSchema=eo.GithubRepositoryOut$outboundSchema})(nOt||(eo.GithubRepositoryOut$=nOt={}));function cVr(t){return JSON.stringify(eo.GithubRepositoryOut$outboundSchema.parse(t))}function dVr(t){return(0,lVr.safeParse)(t,e=>eo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var qte=b(eu=>{"use strict";var fVr=eu&&eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pVr=eu&&eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hVr=eu&&eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fVr(e,t,r);return pVr(e,t),e};Object.defineProperty(eu,"__esModule",{value:!0});eu.JobMetadataOut$=eu.JobMetadataOut$outboundSchema=eu.JobMetadataOut$inboundSchema=void 0;eu.jobMetadataOutToJSON=gVr;eu.jobMetadataOutFromJSON=yVr;var Do=hVr(ge()),aOt=Ee(),mVr=de();eu.JobMetadataOut$inboundSchema=Do.object({expected_duration_seconds:Do.nullable(Do.number().int()).optional(),cost:Do.nullable(Do.number()).optional(),cost_currency:Do.nullable(Do.string()).optional(),train_tokens_per_step:Do.nullable(Do.number().int()).optional(),train_tokens:Do.nullable(Do.number().int()).optional(),data_tokens:Do.nullable(Do.number().int()).optional(),estimated_start_time:Do.nullable(Do.number().int()).optional()}).transform(t=>(0,aOt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));eu.JobMetadataOut$outboundSchema=Do.object({expectedDurationSeconds:Do.nullable(Do.number().int()).optional(),cost:Do.nullable(Do.number()).optional(),costCurrency:Do.nullable(Do.string()).optional(),trainTokensPerStep:Do.nullable(Do.number().int()).optional(),trainTokens:Do.nullable(Do.number().int()).optional(),dataTokens:Do.nullable(Do.number().int()).optional(),estimatedStartTime:Do.nullable(Do.number().int()).optional()}).transform(t=>(0,aOt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time"}));var iOt;(function(t){t.inboundSchema=eu.JobMetadataOut$inboundSchema,t.outboundSchema=eu.JobMetadataOut$outboundSchema})(iOt||(eu.JobMetadataOut$=iOt={}));function gVr(t){return JSON.stringify(eu.JobMetadataOut$outboundSchema.parse(t))}function yVr(t){return(0,mVr.safeParse)(t,e=>eu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Ute=b(tu=>{"use strict";var bVr=tu&&tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Vr=tu&&tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vVr=tu&&tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bVr(e,t,r);return _Vr(e,t),e};Object.defineProperty(tu,"__esModule",{value:!0});tu.TrainingParameters$=tu.TrainingParameters$outboundSchema=tu.TrainingParameters$inboundSchema=void 0;tu.trainingParametersToJSON=SVr;tu.trainingParametersFromJSON=xVr;var Go=vVr(ge()),uOt=Ee(),wVr=de();tu.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(t=>(0,uOt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));tu.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(t=>(0,uOt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var sOt;(function(t){t.inboundSchema=tu.TrainingParameters$inboundSchema,t.outboundSchema=tu.TrainingParameters$outboundSchema})(sOt||(tu.TrainingParameters$=sOt={}));function SVr(t){return JSON.stringify(tu.TrainingParameters$outboundSchema.parse(t))}function xVr(t){return(0,wVr.safeParse)(t,e=>tu.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var zte=b(to=>{"use strict";var CVr=to&&to.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OVr=to&&to.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EVr=to&&to.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CVr(e,t,r);return OVr(e,t),e};Object.defineProperty(to,"__esModule",{value:!0});to.WandbIntegrationOut$=to.WandbIntegrationOut$outboundSchema=to.WandbIntegrationOut$inboundSchema=to.WandbIntegrationOutType$=to.WandbIntegrationOutType$outboundSchema=to.WandbIntegrationOutType$inboundSchema=to.WandbIntegrationOutType=void 0;to.wandbIntegrationOutToJSON=TVr;to.wandbIntegrationOutFromJSON=MVr;var Kd=EVr(ge()),dOt=Ee(),PVr=de();to.WandbIntegrationOutType={Wandb:"wandb"};to.WandbIntegrationOutType$inboundSchema=Kd.nativeEnum(to.WandbIntegrationOutType);to.WandbIntegrationOutType$outboundSchema=to.WandbIntegrationOutType$inboundSchema;var lOt;(function(t){t.inboundSchema=to.WandbIntegrationOutType$inboundSchema,t.outboundSchema=to.WandbIntegrationOutType$outboundSchema})(lOt||(to.WandbIntegrationOutType$=lOt={}));to.WandbIntegrationOut$inboundSchema=Kd.object({type:Kd.literal("wandb").default("wandb"),project:Kd.string(),name:Kd.nullable(Kd.string()).optional(),run_name:Kd.nullable(Kd.string()).optional()}).transform(t=>(0,dOt.remap)(t,{run_name:"runName"}));to.WandbIntegrationOut$outboundSchema=Kd.object({type:Kd.literal("wandb").default("wandb"),project:Kd.string(),name:Kd.nullable(Kd.string()).optional(),runName:Kd.nullable(Kd.string()).optional()}).transform(t=>(0,dOt.remap)(t,{runName:"run_name"}));var cOt;(function(t){t.inboundSchema=to.WandbIntegrationOut$inboundSchema,t.outboundSchema=to.WandbIntegrationOut$outboundSchema})(cOt||(to.WandbIntegrationOut$=cOt={}));function TVr(t){return JSON.stringify(to.WandbIntegrationOut$outboundSchema.parse(t))}function MVr(t){return(0,PVr.safeParse)(t,e=>to.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var SOt=b(Ke=>{"use strict";var AVr=Ke&&Ke.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RVr=Ke&&Ke.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IVr=Ke&&Ke.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AVr(e,t,r);return RVr(e,t),e};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=DVr;Ke.detailedJobOutIntegrationsFromJSON=jVr;Ke.detailedJobOutRepositoriesToJSON=NVr;Ke.detailedJobOutRepositoriesFromJSON=LVr;Ke.detailedJobOutToJSON=FVr;Ke.detailedJobOutFromJSON=kVr;var Nt=IVr(ge()),yOt=Ee(),GOe=de(),bOt=UOe(),_Ot=JOe(),Hte=$te(),vOt=qte(),wOt=Ute(),Vte=zte();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=Nt.nativeEnum(Ke.DetailedJobOutStatus);Ke.DetailedJobOutStatus$outboundSchema=Ke.DetailedJobOutStatus$inboundSchema;var fOt;(function(t){t.inboundSchema=Ke.DetailedJobOutStatus$inboundSchema,t.outboundSchema=Ke.DetailedJobOutStatus$outboundSchema})(fOt||(Ke.DetailedJobOutStatus$=fOt={}));Ke.DetailedJobOutObject$inboundSchema=Nt.nativeEnum(Ke.DetailedJobOutObject);Ke.DetailedJobOutObject$outboundSchema=Ke.DetailedJobOutObject$inboundSchema;var pOt;(function(t){t.inboundSchema=Ke.DetailedJobOutObject$inboundSchema,t.outboundSchema=Ke.DetailedJobOutObject$outboundSchema})(pOt||(Ke.DetailedJobOutObject$=pOt={}));Ke.DetailedJobOutIntegrations$inboundSchema=Vte.WandbIntegrationOut$inboundSchema;Ke.DetailedJobOutIntegrations$outboundSchema=Vte.WandbIntegrationOut$outboundSchema;var hOt;(function(t){t.inboundSchema=Ke.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Ke.DetailedJobOutIntegrations$outboundSchema})(hOt||(Ke.DetailedJobOutIntegrations$=hOt={}));function DVr(t){return JSON.stringify(Ke.DetailedJobOutIntegrations$outboundSchema.parse(t))}function jVr(t){return(0,GOe.safeParse)(t,e=>Ke.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}Ke.DetailedJobOutRepositories$inboundSchema=Hte.GithubRepositoryOut$inboundSchema;Ke.DetailedJobOutRepositories$outboundSchema=Hte.GithubRepositoryOut$outboundSchema;var mOt;(function(t){t.inboundSchema=Ke.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=Ke.DetailedJobOutRepositories$outboundSchema})(mOt||(Ke.DetailedJobOutRepositories$=mOt={}));function NVr(t){return JSON.stringify(Ke.DetailedJobOutRepositories$outboundSchema.parse(t))}function LVr(t){return(0,GOe.safeParse)(t,e=>Ke.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}Ke.DetailedJobOut$inboundSchema=Nt.object({id:Nt.string(),auto_start:Nt.boolean(),hyperparameters:wOt.TrainingParameters$inboundSchema,model:Nt.string(),status:Ke.DetailedJobOutStatus$inboundSchema,job_type:Nt.string(),created_at:Nt.number().int(),modified_at:Nt.number().int(),training_files:Nt.array(Nt.string()),validation_files:Nt.nullable(Nt.array(Nt.string())).optional(),object:Nt.literal("job").default("job"),fine_tuned_model:Nt.nullable(Nt.string()).optional(),suffix:Nt.nullable(Nt.string()).optional(),integrations:Nt.nullable(Nt.array(Vte.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Nt.nullable(Nt.number().int()).optional(),repositories:Nt.array(Hte.GithubRepositoryOut$inboundSchema).optional(),metadata:Nt.nullable(vOt.JobMetadataOut$inboundSchema).optional(),events:Nt.array(_Ot.EventOut$inboundSchema).optional(),checkpoints:Nt.array(bOt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,yOt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));Ke.DetailedJobOut$outboundSchema=Nt.object({id:Nt.string(),autoStart:Nt.boolean(),hyperparameters:wOt.TrainingParameters$outboundSchema,model:Nt.string(),status:Ke.DetailedJobOutStatus$outboundSchema,jobType:Nt.string(),createdAt:Nt.number().int(),modifiedAt:Nt.number().int(),trainingFiles:Nt.array(Nt.string()),validationFiles:Nt.nullable(Nt.array(Nt.string())).optional(),object:Nt.literal("job").default("job"),fineTunedModel:Nt.nullable(Nt.string()).optional(),suffix:Nt.nullable(Nt.string()).optional(),integrations:Nt.nullable(Nt.array(Vte.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Nt.nullable(Nt.number().int()).optional(),repositories:Nt.array(Hte.GithubRepositoryOut$outboundSchema).optional(),metadata:Nt.nullable(vOt.JobMetadataOut$outboundSchema).optional(),events:Nt.array(_Ot.EventOut$outboundSchema).optional(),checkpoints:Nt.array(bOt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,yOt.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var gOt;(function(t){t.inboundSchema=Ke.DetailedJobOut$inboundSchema,t.outboundSchema=Ke.DetailedJobOut$outboundSchema})(gOt||(Ke.DetailedJobOut$=gOt={}));function FVr(t){return JSON.stringify(Ke.DetailedJobOut$outboundSchema.parse(t))}function kVr(t){return(0,GOe.safeParse)(t,e=>Ke.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var POt=b(ro=>{"use strict";var BVr=ro&&ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Vr=ro&&ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qVr=ro&&ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BVr(e,t,r);return $Vr(e,t),e};Object.defineProperty(ro,"__esModule",{value:!0});ro.EmbeddingRequest$=ro.EmbeddingRequest$outboundSchema=ro.EmbeddingRequest$inboundSchema=ro.Inputs$=ro.Inputs$outboundSchema=ro.Inputs$inboundSchema=void 0;ro.inputsToJSON=UVr;ro.inputsFromJSON=zVr;ro.embeddingRequestToJSON=HVr;ro.embeddingRequestFromJSON=VVr;var Xi=qVr(ge()),OOt=Ee(),EOt=de();ro.Inputs$inboundSchema=Xi.union([Xi.string(),Xi.array(Xi.string())]);ro.Inputs$outboundSchema=Xi.union([Xi.string(),Xi.array(Xi.string())]);var xOt;(function(t){t.inboundSchema=ro.Inputs$inboundSchema,t.outboundSchema=ro.Inputs$outboundSchema})(xOt||(ro.Inputs$=xOt={}));function UVr(t){return JSON.stringify(ro.Inputs$outboundSchema.parse(t))}function zVr(t){return(0,EOt.safeParse)(t,e=>ro.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}ro.EmbeddingRequest$inboundSchema=Xi.object({input:Xi.union([Xi.string(),Xi.array(Xi.string())]),model:Xi.string().default("mistral-embed"),encoding_format:Xi.nullable(Xi.string()).optional()}).transform(t=>(0,OOt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));ro.EmbeddingRequest$outboundSchema=Xi.object({inputs:Xi.union([Xi.string(),Xi.array(Xi.string())]),model:Xi.string().default("mistral-embed"),encodingFormat:Xi.nullable(Xi.string()).optional()}).transform(t=>(0,OOt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var COt;(function(t){t.inboundSchema=ro.EmbeddingRequest$inboundSchema,t.outboundSchema=ro.EmbeddingRequest$outboundSchema})(COt||(ro.EmbeddingRequest$=COt={}));function HVr(t){return JSON.stringify(ro.EmbeddingRequest$outboundSchema.parse(t))}function VVr(t){return(0,EOt.safeParse)(t,e=>ro.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var KOe=b(ru=>{"use strict";var WVr=ru&&ru.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JVr=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GVr=ru&&ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WVr(e,t,r);return JVr(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.EmbeddingResponseData$=ru.EmbeddingResponseData$outboundSchema=ru.EmbeddingResponseData$inboundSchema=void 0;ru.embeddingResponseDataToJSON=YVr;ru.embeddingResponseDataFromJSON=XVr;var mS=GVr(ge()),KVr=de();ru.EmbeddingResponseData$inboundSchema=mS.object({object:mS.string().optional(),embedding:mS.array(mS.number()).optional(),index:mS.number().int().optional()});ru.EmbeddingResponseData$outboundSchema=mS.object({object:mS.string().optional(),embedding:mS.array(mS.number()).optional(),index:mS.number().int().optional()});var TOt;(function(t){t.inboundSchema=ru.EmbeddingResponseData$inboundSchema,t.outboundSchema=ru.EmbeddingResponseData$outboundSchema})(TOt||(ru.EmbeddingResponseData$=TOt={}));function YVr(t){return JSON.stringify(ru.EmbeddingResponseData$outboundSchema.parse(t))}function XVr(t){return(0,KVr.safeParse)(t,e=>ru.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var IOt=b(nu=>{"use strict";var ZVr=nu&&nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QVr=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e5r=nu&&nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZVr(e,t,r);return QVr(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.EmbeddingResponse$=nu.EmbeddingResponse$outboundSchema=nu.EmbeddingResponse$inboundSchema=void 0;nu.embeddingResponseToJSON=r5r;nu.embeddingResponseFromJSON=n5r;var gS=e5r(ge()),t5r=de(),AOt=KOe(),ROt=qB();nu.EmbeddingResponse$inboundSchema=gS.object({id:gS.string(),object:gS.string(),model:gS.string(),usage:ROt.UsageInfo$inboundSchema,data:gS.array(AOt.EmbeddingResponseData$inboundSchema)});nu.EmbeddingResponse$outboundSchema=gS.object({id:gS.string(),object:gS.string(),model:gS.string(),usage:ROt.UsageInfo$outboundSchema,data:gS.array(AOt.EmbeddingResponseData$outboundSchema)});var MOt;(function(t){t.inboundSchema=nu.EmbeddingResponse$inboundSchema,t.outboundSchema=nu.EmbeddingResponse$outboundSchema})(MOt||(nu.EmbeddingResponse$=MOt={}));function r5r(t){return JSON.stringify(nu.EmbeddingResponse$outboundSchema.parse(t))}function n5r(t){return(0,t5r.safeParse)(t,e=>nu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var x8=b(ou=>{"use strict";var o5r=ou&&ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i5r=ou&&ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a5r=ou&&ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o5r(e,t,r);return i5r(e,t),e};Object.defineProperty(ou,"__esModule",{value:!0});ou.FilePurpose$=ou.FilePurpose$outboundSchema=ou.FilePurpose$inboundSchema=ou.FilePurpose=void 0;var lD=a5r(ge()),s5r=RT();ou.FilePurpose={FineTune:"fine-tune",Batch:"batch"};ou.FilePurpose$inboundSchema=lD.union([lD.nativeEnum(ou.FilePurpose),lD.string().transform(s5r.catchUnrecognizedEnum)]);ou.FilePurpose$outboundSchema=lD.union([lD.nativeEnum(ou.FilePurpose),lD.string().and(lD.custom())]);var DOt;(function(t){t.inboundSchema=ou.FilePurpose$inboundSchema,t.outboundSchema=ou.FilePurpose$outboundSchema})(DOt||(ou.FilePurpose$=DOt={}))});var C8=b(iu=>{"use strict";var u5r=iu&&iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l5r=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c5r=iu&&iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u5r(e,t,r);return l5r(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.SampleType$=iu.SampleType$outboundSchema=iu.SampleType$inboundSchema=iu.SampleType=void 0;var cD=c5r(ge()),d5r=RT();iu.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};iu.SampleType$inboundSchema=cD.union([cD.nativeEnum(iu.SampleType),cD.string().transform(d5r.catchUnrecognizedEnum)]);iu.SampleType$outboundSchema=cD.union([cD.nativeEnum(iu.SampleType),cD.string().and(cD.custom())]);var jOt;(function(t){t.inboundSchema=iu.SampleType$inboundSchema,t.outboundSchema=iu.SampleType$outboundSchema})(jOt||(iu.SampleType$=jOt={}))});var O8=b(au=>{"use strict";var f5r=au&&au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p5r=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h5r=au&&au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f5r(e,t,r);return p5r(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.Source$=au.Source$outboundSchema=au.Source$inboundSchema=au.Source=void 0;var dD=h5r(ge()),m5r=RT();au.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};au.Source$inboundSchema=dD.union([dD.nativeEnum(au.Source),dD.string().transform(m5r.catchUnrecognizedEnum)]);au.Source$outboundSchema=dD.union([dD.nativeEnum(au.Source),dD.string().and(dD.custom())]);var NOt;(function(t){t.inboundSchema=au.Source$inboundSchema,t.outboundSchema=au.Source$outboundSchema})(NOt||(au.Source$=NOt={}))});var YOe=b(su=>{"use strict";var g5r=su&&su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y5r=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b5r=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g5r(e,t,r);return y5r(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.FileSchema$=su.FileSchema$outboundSchema=su.FileSchema$inboundSchema=void 0;su.fileSchemaToJSON=v5r;su.fileSchemaFromJSON=w5r;var dd=b5r(ge()),FOt=Ee(),_5r=de(),kOt=x8(),BOt=C8(),$Ot=O8();su.FileSchema$inboundSchema=dd.object({id:dd.string(),object:dd.string(),bytes:dd.number().int(),created_at:dd.number().int(),filename:dd.string(),purpose:kOt.FilePurpose$inboundSchema,sample_type:BOt.SampleType$inboundSchema,num_lines:dd.nullable(dd.number().int()).optional(),source:$Ot.Source$inboundSchema}).transform(t=>(0,FOt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));su.FileSchema$outboundSchema=dd.object({id:dd.string(),object:dd.string(),sizeBytes:dd.number().int(),createdAt:dd.number().int(),filename:dd.string(),purpose:kOt.FilePurpose$outboundSchema,sampleType:BOt.SampleType$outboundSchema,numLines:dd.nullable(dd.number().int()).optional(),source:$Ot.Source$outboundSchema}).transform(t=>(0,FOt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var LOt;(function(t){t.inboundSchema=su.FileSchema$inboundSchema,t.outboundSchema=su.FileSchema$outboundSchema})(LOt||(su.FileSchema$=LOt={}));function v5r(t){return JSON.stringify(su.FileSchema$outboundSchema.parse(t))}function w5r(t){return(0,_5r.safeParse)(t,e=>su.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var UOt=b(uu=>{"use strict";var S5r=uu&&uu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x5r=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C5r=uu&&uu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S5r(e,t,r);return x5r(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.FileSignedURL$=uu.FileSignedURL$outboundSchema=uu.FileSignedURL$inboundSchema=void 0;uu.fileSignedURLToJSON=E5r;uu.fileSignedURLFromJSON=P5r;var Wte=C5r(ge()),O5r=de();uu.FileSignedURL$inboundSchema=Wte.object({url:Wte.string()});uu.FileSignedURL$outboundSchema=Wte.object({url:Wte.string()});var qOt;(function(t){t.inboundSchema=uu.FileSignedURL$inboundSchema,t.outboundSchema=uu.FileSignedURL$outboundSchema})(qOt||(uu.FileSignedURL$=qOt={}));function E5r(t){return JSON.stringify(uu.FileSignedURL$outboundSchema.parse(t))}function P5r(t){return(0,O5r.safeParse)(t,e=>uu.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var JOt=b(no=>{"use strict";var T5r=no&&no.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M5r=no&&no.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A5r=no&&no.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&T5r(e,t,r);return M5r(e,t),e};Object.defineProperty(no,"__esModule",{value:!0});no.FIMCompletionRequest$=no.FIMCompletionRequest$outboundSchema=no.FIMCompletionRequest$inboundSchema=no.FIMCompletionRequestStop$=no.FIMCompletionRequestStop$outboundSchema=no.FIMCompletionRequestStop$inboundSchema=void 0;no.fimCompletionRequestStopToJSON=R5r;no.fimCompletionRequestStopFromJSON=I5r;no.fimCompletionRequestToJSON=D5r;no.fimCompletionRequestFromJSON=j5r;var Vt=A5r(ge()),VOt=Ee(),WOt=de();no.FIMCompletionRequestStop$inboundSchema=Vt.union([Vt.string(),Vt.array(Vt.string())]);no.FIMCompletionRequestStop$outboundSchema=Vt.union([Vt.string(),Vt.array(Vt.string())]);var zOt;(function(t){t.inboundSchema=no.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=no.FIMCompletionRequestStop$outboundSchema})(zOt||(no.FIMCompletionRequestStop$=zOt={}));function R5r(t){return JSON.stringify(no.FIMCompletionRequestStop$outboundSchema.parse(t))}function I5r(t){return(0,WOt.safeParse)(t,e=>no.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}no.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(t=>(0,VOt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));no.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(t=>(0,VOt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var HOt;(function(t){t.inboundSchema=no.FIMCompletionRequest$inboundSchema,t.outboundSchema=no.FIMCompletionRequest$outboundSchema})(HOt||(no.FIMCompletionRequest$=HOt={}));function D5r(t){return JSON.stringify(no.FIMCompletionRequest$outboundSchema.parse(t))}function j5r(t){return(0,WOt.safeParse)(t,e=>no.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var XOt=b(lu=>{"use strict";var N5r=lu&&lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L5r=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5r=lu&&lu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N5r(e,t,r);return L5r(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.FIMCompletionResponse$=lu.FIMCompletionResponse$outboundSchema=lu.FIMCompletionResponse$inboundSchema=void 0;lu.fimCompletionResponseToJSON=B5r;lu.fimCompletionResponseFromJSON=$5r;var hm=F5r(ge()),k5r=de(),KOt=Cte(),YOt=qB();lu.FIMCompletionResponse$inboundSchema=hm.object({id:hm.string(),object:hm.string(),model:hm.string(),usage:YOt.UsageInfo$inboundSchema,created:hm.number().int().optional(),choices:hm.array(KOt.ChatCompletionChoice$inboundSchema).optional()});lu.FIMCompletionResponse$outboundSchema=hm.object({id:hm.string(),object:hm.string(),model:hm.string(),usage:YOt.UsageInfo$outboundSchema,created:hm.number().int().optional(),choices:hm.array(KOt.ChatCompletionChoice$outboundSchema).optional()});var GOt;(function(t){t.inboundSchema=lu.FIMCompletionResponse$inboundSchema,t.outboundSchema=lu.FIMCompletionResponse$outboundSchema})(GOt||(lu.FIMCompletionResponse$=GOt={}));function B5r(t){return JSON.stringify(lu.FIMCompletionResponse$outboundSchema.parse(t))}function $5r(t){return(0,k5r.safeParse)(t,e=>lu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var rEt=b(oo=>{"use strict";var q5r=oo&&oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U5r=oo&&oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z5r=oo&&oo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q5r(e,t,r);return U5r(e,t),e};Object.defineProperty(oo,"__esModule",{value:!0});oo.FIMCompletionStreamRequest$=oo.FIMCompletionStreamRequest$outboundSchema=oo.FIMCompletionStreamRequest$inboundSchema=oo.FIMCompletionStreamRequestStop$=oo.FIMCompletionStreamRequestStop$outboundSchema=oo.FIMCompletionStreamRequestStop$inboundSchema=void 0;oo.fimCompletionStreamRequestStopToJSON=H5r;oo.fimCompletionStreamRequestStopFromJSON=V5r;oo.fimCompletionStreamRequestToJSON=W5r;oo.fimCompletionStreamRequestFromJSON=J5r;var Wt=z5r(ge()),eEt=Ee(),tEt=de();oo.FIMCompletionStreamRequestStop$inboundSchema=Wt.union([Wt.string(),Wt.array(Wt.string())]);oo.FIMCompletionStreamRequestStop$outboundSchema=Wt.union([Wt.string(),Wt.array(Wt.string())]);var ZOt;(function(t){t.inboundSchema=oo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=oo.FIMCompletionStreamRequestStop$outboundSchema})(ZOt||(oo.FIMCompletionStreamRequestStop$=ZOt={}));function H5r(t){return JSON.stringify(oo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function V5r(t){return(0,tEt.safeParse)(t,e=>oo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}oo.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(t=>(0,eEt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));oo.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(t=>(0,eEt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var QOt;(function(t){t.inboundSchema=oo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=oo.FIMCompletionStreamRequest$outboundSchema})(QOt||(oo.FIMCompletionStreamRequest$=QOt={}));function W5r(t){return JSON.stringify(oo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function J5r(t){return(0,tEt.safeParse)(t,e=>oo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var XOe=b(cu=>{"use strict";var G5r=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K5r=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5r=cu&&cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G5r(e,t,r);return K5r(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.FTModelCapabilitiesOut$=cu.FTModelCapabilitiesOut$outboundSchema=cu.FTModelCapabilitiesOut$inboundSchema=void 0;cu.ftModelCapabilitiesOutToJSON=Z5r;cu.ftModelCapabilitiesOutFromJSON=Q5r;var yS=Y5r(ge()),oEt=Ee(),X5r=de();cu.FTModelCapabilitiesOut$inboundSchema=yS.object({completion_chat:yS.boolean().default(!0),completion_fim:yS.boolean().default(!1),function_calling:yS.boolean().default(!1),fine_tuning:yS.boolean().default(!1)}).transform(t=>(0,oEt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));cu.FTModelCapabilitiesOut$outboundSchema=yS.object({completionChat:yS.boolean().default(!0),completionFim:yS.boolean().default(!1),functionCalling:yS.boolean().default(!1),fineTuning:yS.boolean().default(!1)}).transform(t=>(0,oEt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var nEt;(function(t){t.inboundSchema=cu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=cu.FTModelCapabilitiesOut$outboundSchema})(nEt||(cu.FTModelCapabilitiesOut$=nEt={}));function Z5r(t){return JSON.stringify(cu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function Q5r(t){return(0,X5r.safeParse)(t,e=>cu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var ZOe=b(io=>{"use strict";var e9r=io&&io.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t9r=io&&io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r9r=io&&io.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e9r(e,t,r);return t9r(e,t),e};Object.defineProperty(io,"__esModule",{value:!0});io.FTModelCard$=io.FTModelCard$outboundSchema=io.FTModelCard$inboundSchema=io.FTModelCardType$=io.FTModelCardType$outboundSchema=io.FTModelCardType$inboundSchema=io.FTModelCardType=void 0;io.ftModelCardToJSON=o9r;io.ftModelCardFromJSON=i9r;var Rr=r9r(ge()),sEt=Ee(),n9r=de(),uEt=Ste();io.FTModelCardType={FineTuned:"fine-tuned"};io.FTModelCardType$inboundSchema=Rr.nativeEnum(io.FTModelCardType);io.FTModelCardType$outboundSchema=io.FTModelCardType$inboundSchema;var iEt;(function(t){t.inboundSchema=io.FTModelCardType$inboundSchema,t.outboundSchema=io.FTModelCardType$outboundSchema})(iEt||(io.FTModelCardType$=iEt={}));io.FTModelCard$inboundSchema=Rr.object({id:Rr.string(),object:Rr.string().default("model"),created:Rr.number().int().optional(),owned_by:Rr.string().default("mistralai"),capabilities:uEt.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(t=>new Date(t))).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(t=>(0,sEt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));io.FTModelCard$outboundSchema=Rr.object({id:Rr.string(),object:Rr.string().default("model"),created:Rr.number().int().optional(),ownedBy:Rr.string().default("mistralai"),capabilities:uEt.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(t=>t.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(t=>(0,sEt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var aEt;(function(t){t.inboundSchema=io.FTModelCard$inboundSchema,t.outboundSchema=io.FTModelCard$outboundSchema})(aEt||(io.FTModelCard$=aEt={}));function o9r(t){return JSON.stringify(io.FTModelCard$outboundSchema.parse(t))}function i9r(t){return(0,n9r.safeParse)(t,e=>io.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var pEt=b(ao=>{"use strict";var a9r=ao&&ao.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s9r=ao&&ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u9r=ao&&ao.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a9r(e,t,r);return s9r(e,t),e};Object.defineProperty(ao,"__esModule",{value:!0});ao.FTModelOut$=ao.FTModelOut$outboundSchema=ao.FTModelOut$inboundSchema=ao.FTModelOutObject$=ao.FTModelOutObject$outboundSchema=ao.FTModelOutObject$inboundSchema=ao.FTModelOutObject=void 0;ao.ftModelOutToJSON=c9r;ao.ftModelOutFromJSON=d9r;var Co=u9r(ge()),dEt=Ee(),l9r=de(),fEt=XOe();ao.FTModelOutObject={Model:"model"};ao.FTModelOutObject$inboundSchema=Co.nativeEnum(ao.FTModelOutObject);ao.FTModelOutObject$outboundSchema=ao.FTModelOutObject$inboundSchema;var lEt;(function(t){t.inboundSchema=ao.FTModelOutObject$inboundSchema,t.outboundSchema=ao.FTModelOutObject$outboundSchema})(lEt||(ao.FTModelOutObject$=lEt={}));ao.FTModelOut$inboundSchema=Co.object({id:Co.string(),object:Co.literal("model").default("model"),created:Co.number().int(),owned_by:Co.string(),root:Co.string(),archived:Co.boolean(),name:Co.nullable(Co.string()).optional(),description:Co.nullable(Co.string()).optional(),capabilities:fEt.FTModelCapabilitiesOut$inboundSchema,max_context_length:Co.number().int().default(32768),aliases:Co.array(Co.string()).optional(),job:Co.string()}).transform(t=>(0,dEt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));ao.FTModelOut$outboundSchema=Co.object({id:Co.string(),object:Co.literal("model").default("model"),created:Co.number().int(),ownedBy:Co.string(),root:Co.string(),archived:Co.boolean(),name:Co.nullable(Co.string()).optional(),description:Co.nullable(Co.string()).optional(),capabilities:fEt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Co.number().int().default(32768),aliases:Co.array(Co.string()).optional(),job:Co.string()}).transform(t=>(0,dEt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var cEt;(function(t){t.inboundSchema=ao.FTModelOut$inboundSchema,t.outboundSchema=ao.FTModelOut$outboundSchema})(cEt||(ao.FTModelOut$=cEt={}));function c9r(t){return JSON.stringify(ao.FTModelOut$outboundSchema.parse(t))}function d9r(t){return(0,l9r.safeParse)(t,e=>ao.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var QOe=b(so=>{"use strict";var f9r=so&&so.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p9r=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h9r=so&&so.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f9r(e,t,r);return p9r(e,t),e};Object.defineProperty(so,"__esModule",{value:!0});so.GithubRepositoryIn$=so.GithubRepositoryIn$outboundSchema=so.GithubRepositoryIn$inboundSchema=so.GithubRepositoryInType$=so.GithubRepositoryInType$outboundSchema=so.GithubRepositoryInType$inboundSchema=so.GithubRepositoryInType=void 0;so.githubRepositoryInToJSON=g9r;so.githubRepositoryInFromJSON=y9r;var vc=h9r(ge()),m9r=de();so.GithubRepositoryInType={Github:"github"};so.GithubRepositoryInType$inboundSchema=vc.nativeEnum(so.GithubRepositoryInType);so.GithubRepositoryInType$outboundSchema=so.GithubRepositoryInType$inboundSchema;var hEt;(function(t){t.inboundSchema=so.GithubRepositoryInType$inboundSchema,t.outboundSchema=so.GithubRepositoryInType$outboundSchema})(hEt||(so.GithubRepositoryInType$=hEt={}));so.GithubRepositoryIn$inboundSchema=vc.object({type:vc.literal("github").default("github"),name:vc.string(),owner:vc.string(),ref:vc.nullable(vc.string()).optional(),weight:vc.number().default(1),token:vc.string()});so.GithubRepositoryIn$outboundSchema=vc.object({type:vc.literal("github").default("github"),name:vc.string(),owner:vc.string(),ref:vc.nullable(vc.string()).optional(),weight:vc.number().default(1),token:vc.string()});var mEt;(function(t){t.inboundSchema=so.GithubRepositoryIn$inboundSchema,t.outboundSchema=so.GithubRepositoryIn$outboundSchema})(mEt||(so.GithubRepositoryIn$=mEt={}));function g9r(t){return JSON.stringify(so.GithubRepositoryIn$outboundSchema.parse(t))}function y9r(t){return(0,m9r.safeParse)(t,e=>so.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var eEe=b(du=>{"use strict";var b9r=du&&du.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_9r=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v9r=du&&du.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b9r(e,t,r);return _9r(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.TrainingFile$=du.TrainingFile$outboundSchema=du.TrainingFile$inboundSchema=void 0;du.trainingFileToJSON=S9r;du.trainingFileFromJSON=x9r;var zB=v9r(ge()),yEt=Ee(),w9r=de();du.TrainingFile$inboundSchema=zB.object({file_id:zB.string(),weight:zB.number().default(1)}).transform(t=>(0,yEt.remap)(t,{file_id:"fileId"}));du.TrainingFile$outboundSchema=zB.object({fileId:zB.string(),weight:zB.number().default(1)}).transform(t=>(0,yEt.remap)(t,{fileId:"file_id"}));var gEt;(function(t){t.inboundSchema=du.TrainingFile$inboundSchema,t.outboundSchema=du.TrainingFile$outboundSchema})(gEt||(du.TrainingFile$=gEt={}));function S9r(t){return JSON.stringify(du.TrainingFile$outboundSchema.parse(t))}function x9r(t){return(0,w9r.safeParse)(t,e=>du.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var tEe=b(fu=>{"use strict";var C9r=fu&&fu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O9r=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E9r=fu&&fu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C9r(e,t,r);return O9r(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.TrainingParametersIn$=fu.TrainingParametersIn$outboundSchema=fu.TrainingParametersIn$inboundSchema=void 0;fu.trainingParametersInToJSON=T9r;fu.trainingParametersInFromJSON=M9r;var Ko=E9r(ge()),_Et=Ee(),P9r=de();fu.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(t=>(0,_Et.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));fu.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(t=>(0,_Et.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var bEt;(function(t){t.inboundSchema=fu.TrainingParametersIn$inboundSchema,t.outboundSchema=fu.TrainingParametersIn$outboundSchema})(bEt||(fu.TrainingParametersIn$=bEt={}));function T9r(t){return JSON.stringify(fu.TrainingParametersIn$outboundSchema.parse(t))}function M9r(t){return(0,P9r.safeParse)(t,e=>fu.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var rEe=b(uo=>{"use strict";var A9r=uo&&uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R9r=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I9r=uo&&uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A9r(e,t,r);return R9r(e,t),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.WandbIntegration$=uo.WandbIntegration$outboundSchema=uo.WandbIntegration$inboundSchema=uo.WandbIntegrationType$=uo.WandbIntegrationType$outboundSchema=uo.WandbIntegrationType$inboundSchema=uo.WandbIntegrationType=void 0;uo.wandbIntegrationToJSON=j9r;uo.wandbIntegrationFromJSON=N9r;var wc=I9r(ge()),SEt=Ee(),D9r=de();uo.WandbIntegrationType={Wandb:"wandb"};uo.WandbIntegrationType$inboundSchema=wc.nativeEnum(uo.WandbIntegrationType);uo.WandbIntegrationType$outboundSchema=uo.WandbIntegrationType$inboundSchema;var vEt;(function(t){t.inboundSchema=uo.WandbIntegrationType$inboundSchema,t.outboundSchema=uo.WandbIntegrationType$outboundSchema})(vEt||(uo.WandbIntegrationType$=vEt={}));uo.WandbIntegration$inboundSchema=wc.object({type:wc.literal("wandb").default("wandb"),project:wc.string(),name:wc.nullable(wc.string()).optional(),api_key:wc.string(),run_name:wc.nullable(wc.string()).optional()}).transform(t=>(0,SEt.remap)(t,{api_key:"apiKey",run_name:"runName"}));uo.WandbIntegration$outboundSchema=wc.object({type:wc.literal("wandb").default("wandb"),project:wc.string(),name:wc.nullable(wc.string()).optional(),apiKey:wc.string(),runName:wc.nullable(wc.string()).optional()}).transform(t=>(0,SEt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var wEt;(function(t){t.inboundSchema=uo.WandbIntegration$inboundSchema,t.outboundSchema=uo.WandbIntegration$outboundSchema})(wEt||(uo.WandbIntegration$=wEt={}));function j9r(t){return JSON.stringify(uo.WandbIntegration$outboundSchema.parse(t))}function N9r(t){return(0,D9r.safeParse)(t,e=>uo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var MEt=b(lr=>{"use strict";var L9r=lr&&lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F9r=lr&&lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k9r=lr&&lr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L9r(e,t,r);return F9r(e,t),e};Object.defineProperty(lr,"__esModule",{value:!0});lr.JobIn$=lr.JobIn$outboundSchema=lr.JobIn$inboundSchema=lr.JobInRepositories$=lr.JobInRepositories$outboundSchema=lr.JobInRepositories$inboundSchema=lr.JobInIntegrations$=lr.JobInIntegrations$outboundSchema=lr.JobInIntegrations$inboundSchema=void 0;lr.jobInIntegrationsToJSON=B9r;lr.jobInIntegrationsFromJSON=$9r;lr.jobInRepositoriesToJSON=q9r;lr.jobInRepositoriesFromJSON=U9r;lr.jobInToJSON=z9r;lr.jobInFromJSON=H9r;var Zi=k9r(ge()),EEt=Ee(),nEe=de(),Jte=QOe(),PEt=eEe(),TEt=tEe(),Gte=rEe();lr.JobInIntegrations$inboundSchema=Gte.WandbIntegration$inboundSchema;lr.JobInIntegrations$outboundSchema=Gte.WandbIntegration$outboundSchema;var xEt;(function(t){t.inboundSchema=lr.JobInIntegrations$inboundSchema,t.outboundSchema=lr.JobInIntegrations$outboundSchema})(xEt||(lr.JobInIntegrations$=xEt={}));function B9r(t){return JSON.stringify(lr.JobInIntegrations$outboundSchema.parse(t))}function $9r(t){return(0,nEe.safeParse)(t,e=>lr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}lr.JobInRepositories$inboundSchema=Jte.GithubRepositoryIn$inboundSchema;lr.JobInRepositories$outboundSchema=Jte.GithubRepositoryIn$outboundSchema;var CEt;(function(t){t.inboundSchema=lr.JobInRepositories$inboundSchema,t.outboundSchema=lr.JobInRepositories$outboundSchema})(CEt||(lr.JobInRepositories$=CEt={}));function q9r(t){return JSON.stringify(lr.JobInRepositories$outboundSchema.parse(t))}function U9r(t){return(0,nEe.safeParse)(t,e=>lr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}lr.JobIn$inboundSchema=Zi.object({model:Zi.string(),training_files:Zi.array(PEt.TrainingFile$inboundSchema).optional(),validation_files:Zi.nullable(Zi.array(Zi.string())).optional(),hyperparameters:TEt.TrainingParametersIn$inboundSchema,suffix:Zi.nullable(Zi.string()).optional(),integrations:Zi.nullable(Zi.array(Gte.WandbIntegration$inboundSchema)).optional(),repositories:Zi.array(Jte.GithubRepositoryIn$inboundSchema).optional(),auto_start:Zi.boolean().optional()}).transform(t=>(0,EEt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));lr.JobIn$outboundSchema=Zi.object({model:Zi.string(),trainingFiles:Zi.array(PEt.TrainingFile$outboundSchema).optional(),validationFiles:Zi.nullable(Zi.array(Zi.string())).optional(),hyperparameters:TEt.TrainingParametersIn$outboundSchema,suffix:Zi.nullable(Zi.string()).optional(),integrations:Zi.nullable(Zi.array(Gte.WandbIntegration$outboundSchema)).optional(),repositories:Zi.array(Jte.GithubRepositoryIn$outboundSchema).optional(),autoStart:Zi.boolean().optional()}).transform(t=>(0,EEt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var OEt;(function(t){t.inboundSchema=lr.JobIn$inboundSchema,t.outboundSchema=lr.JobIn$outboundSchema})(OEt||(lr.JobIn$=OEt={}));function z9r(t){return JSON.stringify(lr.JobIn$outboundSchema.parse(t))}function H9r(t){return(0,nEe.safeParse)(t,e=>lr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var iEe=b(Ye=>{"use strict";var V9r=Ye&&Ye.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W9r=Ye&&Ye.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9r=Ye&&Ye.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V9r(e,t,r);return W9r(e,t),e};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=G9r;Ye.integrationsFromJSON=K9r;Ye.repositoriesToJSON=Y9r;Ye.repositoriesFromJSON=X9r;Ye.jobOutToJSON=Z9r;Ye.jobOutFromJSON=Q9r;var Jt=J9r(ge()),NEt=Ee(),oEe=de(),Kte=$te(),LEt=qte(),FEt=Ute(),Yte=zte();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 AEt;(function(t){t.inboundSchema=Ye.Status$inboundSchema,t.outboundSchema=Ye.Status$outboundSchema})(AEt||(Ye.Status$=AEt={}));Ye.ObjectT$inboundSchema=Jt.nativeEnum(Ye.ObjectT);Ye.ObjectT$outboundSchema=Ye.ObjectT$inboundSchema;var REt;(function(t){t.inboundSchema=Ye.ObjectT$inboundSchema,t.outboundSchema=Ye.ObjectT$outboundSchema})(REt||(Ye.ObjectT$=REt={}));Ye.Integrations$inboundSchema=Yte.WandbIntegrationOut$inboundSchema;Ye.Integrations$outboundSchema=Yte.WandbIntegrationOut$outboundSchema;var IEt;(function(t){t.inboundSchema=Ye.Integrations$inboundSchema,t.outboundSchema=Ye.Integrations$outboundSchema})(IEt||(Ye.Integrations$=IEt={}));function G9r(t){return JSON.stringify(Ye.Integrations$outboundSchema.parse(t))}function K9r(t){return(0,oEe.safeParse)(t,e=>Ye.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}Ye.Repositories$inboundSchema=Kte.GithubRepositoryOut$inboundSchema;Ye.Repositories$outboundSchema=Kte.GithubRepositoryOut$outboundSchema;var DEt;(function(t){t.inboundSchema=Ye.Repositories$inboundSchema,t.outboundSchema=Ye.Repositories$outboundSchema})(DEt||(Ye.Repositories$=DEt={}));function Y9r(t){return JSON.stringify(Ye.Repositories$outboundSchema.parse(t))}function X9r(t){return(0,oEe.safeParse)(t,e=>Ye.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}Ye.JobOut$inboundSchema=Jt.object({id:Jt.string(),auto_start:Jt.boolean(),hyperparameters:FEt.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(Yte.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Jt.nullable(Jt.number().int()).optional(),repositories:Jt.array(Kte.GithubRepositoryOut$inboundSchema).optional(),metadata:Jt.nullable(LEt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,NEt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));Ye.JobOut$outboundSchema=Jt.object({id:Jt.string(),autoStart:Jt.boolean(),hyperparameters:FEt.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(Yte.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Jt.nullable(Jt.number().int()).optional(),repositories:Jt.array(Kte.GithubRepositoryOut$outboundSchema).optional(),metadata:Jt.nullable(LEt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,NEt.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var jEt;(function(t){t.inboundSchema=Ye.JobOut$inboundSchema,t.outboundSchema=Ye.JobOut$outboundSchema})(jEt||(Ye.JobOut$=jEt={}));function Z9r(t){return JSON.stringify(Ye.JobOut$outboundSchema.parse(t))}function Q9r(t){return(0,oEe.safeParse)(t,e=>Ye.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var qEt=b(lo=>{"use strict";var eWr=lo&&lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tWr=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rWr=lo&&lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eWr(e,t,r);return tWr(e,t),e};Object.defineProperty(lo,"__esModule",{value:!0});lo.JobsOut$=lo.JobsOut$outboundSchema=lo.JobsOut$inboundSchema=lo.JobsOutObject$=lo.JobsOutObject$outboundSchema=lo.JobsOutObject$inboundSchema=lo.JobsOutObject=void 0;lo.jobsOutToJSON=oWr;lo.jobsOutFromJSON=iWr;var FC=rWr(ge()),nWr=de(),$Et=iEe();lo.JobsOutObject={List:"list"};lo.JobsOutObject$inboundSchema=FC.nativeEnum(lo.JobsOutObject);lo.JobsOutObject$outboundSchema=lo.JobsOutObject$inboundSchema;var kEt;(function(t){t.inboundSchema=lo.JobsOutObject$inboundSchema,t.outboundSchema=lo.JobsOutObject$outboundSchema})(kEt||(lo.JobsOutObject$=kEt={}));lo.JobsOut$inboundSchema=FC.object({data:FC.array($Et.JobOut$inboundSchema).optional(),object:FC.literal("list").default("list"),total:FC.number().int()});lo.JobsOut$outboundSchema=FC.object({data:FC.array($Et.JobOut$outboundSchema).optional(),object:FC.literal("list").default("list"),total:FC.number().int()});var BEt;(function(t){t.inboundSchema=lo.JobsOut$inboundSchema,t.outboundSchema=lo.JobsOut$outboundSchema})(BEt||(lo.JobsOut$=BEt={}));function oWr(t){return JSON.stringify(lo.JobsOut$outboundSchema.parse(t))}function iWr(t){return(0,nWr.safeParse)(t,e=>lo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var VEt=b(co=>{"use strict";var aWr=co&&co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sWr=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uWr=co&&co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aWr(e,t,r);return sWr(e,t),e};Object.defineProperty(co,"__esModule",{value:!0});co.LegacyJobMetadataOut$=co.LegacyJobMetadataOut$outboundSchema=co.LegacyJobMetadataOut$inboundSchema=co.LegacyJobMetadataOutObject$=co.LegacyJobMetadataOutObject$outboundSchema=co.LegacyJobMetadataOutObject$inboundSchema=co.LegacyJobMetadataOutObject=void 0;co.legacyJobMetadataOutToJSON=cWr;co.legacyJobMetadataOutFromJSON=dWr;var sr=uWr(ge()),HEt=Ee(),lWr=de();co.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};co.LegacyJobMetadataOutObject$inboundSchema=sr.nativeEnum(co.LegacyJobMetadataOutObject);co.LegacyJobMetadataOutObject$outboundSchema=co.LegacyJobMetadataOutObject$inboundSchema;var UEt;(function(t){t.inboundSchema=co.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=co.LegacyJobMetadataOutObject$outboundSchema})(UEt||(co.LegacyJobMetadataOutObject$=UEt={}));co.LegacyJobMetadataOut$inboundSchema=sr.object({expected_duration_seconds:sr.nullable(sr.number().int()).optional(),cost:sr.nullable(sr.number()).optional(),cost_currency:sr.nullable(sr.string()).optional(),train_tokens_per_step:sr.nullable(sr.number().int()).optional(),train_tokens:sr.nullable(sr.number().int()).optional(),data_tokens:sr.nullable(sr.number().int()).optional(),estimated_start_time:sr.nullable(sr.number().int()).optional(),deprecated:sr.boolean().default(!0),details:sr.string(),epochs:sr.nullable(sr.number()).optional(),training_steps:sr.nullable(sr.number().int()).optional(),object:sr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,HEt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime",training_steps:"trainingSteps"}));co.LegacyJobMetadataOut$outboundSchema=sr.object({expectedDurationSeconds:sr.nullable(sr.number().int()).optional(),cost:sr.nullable(sr.number()).optional(),costCurrency:sr.nullable(sr.string()).optional(),trainTokensPerStep:sr.nullable(sr.number().int()).optional(),trainTokens:sr.nullable(sr.number().int()).optional(),dataTokens:sr.nullable(sr.number().int()).optional(),estimatedStartTime:sr.nullable(sr.number().int()).optional(),deprecated:sr.boolean().default(!0),details:sr.string(),epochs:sr.nullable(sr.number()).optional(),trainingSteps:sr.nullable(sr.number().int()).optional(),object:sr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,HEt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time",trainingSteps:"training_steps"}));var zEt;(function(t){t.inboundSchema=co.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=co.LegacyJobMetadataOut$outboundSchema})(zEt||(co.LegacyJobMetadataOut$=zEt={}));function cWr(t){return JSON.stringify(co.LegacyJobMetadataOut$outboundSchema.parse(t))}function dWr(t){return(0,lWr.safeParse)(t,e=>co.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var GEt=b(pu=>{"use strict";var fWr=pu&&pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pWr=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hWr=pu&&pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fWr(e,t,r);return pWr(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.ListFilesOut$=pu.ListFilesOut$outboundSchema=pu.ListFilesOut$inboundSchema=void 0;pu.listFilesOutToJSON=gWr;pu.listFilesOutFromJSON=yWr;var FT=hWr(ge()),mWr=de(),JEt=YOe();pu.ListFilesOut$inboundSchema=FT.object({data:FT.array(JEt.FileSchema$inboundSchema),object:FT.string(),total:FT.number().int()});pu.ListFilesOut$outboundSchema=FT.object({data:FT.array(JEt.FileSchema$outboundSchema),object:FT.string(),total:FT.number().int()});var WEt;(function(t){t.inboundSchema=pu.ListFilesOut$inboundSchema,t.outboundSchema=pu.ListFilesOut$outboundSchema})(WEt||(pu.ListFilesOut$=WEt={}));function gWr(t){return JSON.stringify(pu.ListFilesOut$outboundSchema.parse(t))}function yWr(t){return(0,mWr.safeParse)(t,e=>pu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var ZEt=b(fo=>{"use strict";var bWr=fo&&fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Wr=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vWr=fo&&fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bWr(e,t,r);return _Wr(e,t),e};Object.defineProperty(fo,"__esModule",{value:!0});fo.ModelList$=fo.ModelList$outboundSchema=fo.ModelList$inboundSchema=fo.Data$=fo.Data$outboundSchema=fo.Data$inboundSchema=void 0;fo.dataToJSON=wWr;fo.dataFromJSON=SWr;fo.modelListToJSON=xWr;fo.modelListFromJSON=CWr;var fi=vWr(ge()),XEt=de(),Xte=FOe(),Zte=ZOe();fo.Data$inboundSchema=fi.union([Xte.BaseModelCard$inboundSchema.and(fi.object({type:fi.literal("base")}).transform(t=>({type:t.type}))),Zte.FTModelCard$inboundSchema.and(fi.object({type:fi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);fo.Data$outboundSchema=fi.union([Xte.BaseModelCard$outboundSchema.and(fi.object({type:fi.literal("base")}).transform(t=>({type:t.type}))),Zte.FTModelCard$outboundSchema.and(fi.object({type:fi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var KEt;(function(t){t.inboundSchema=fo.Data$inboundSchema,t.outboundSchema=fo.Data$outboundSchema})(KEt||(fo.Data$=KEt={}));function wWr(t){return JSON.stringify(fo.Data$outboundSchema.parse(t))}function SWr(t){return(0,XEt.safeParse)(t,e=>fo.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}fo.ModelList$inboundSchema=fi.object({object:fi.string().default("list"),data:fi.array(fi.union([Xte.BaseModelCard$inboundSchema.and(fi.object({type:fi.literal("base")}).transform(t=>({type:t.type}))),Zte.FTModelCard$inboundSchema.and(fi.object({type:fi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});fo.ModelList$outboundSchema=fi.object({object:fi.string().default("list"),data:fi.array(fi.union([Xte.BaseModelCard$outboundSchema.and(fi.object({type:fi.literal("base")}).transform(t=>({type:t.type}))),Zte.FTModelCard$outboundSchema.and(fi.object({type:fi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var YEt;(function(t){t.inboundSchema=fo.ModelList$inboundSchema,t.outboundSchema=fo.ModelList$outboundSchema})(YEt||(fo.ModelList$=YEt={}));function xWr(t){return JSON.stringify(fo.ModelList$outboundSchema.parse(t))}function CWr(t){return(0,XEt.safeParse)(t,e=>fo.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var oPt=b(hu=>{"use strict";var OWr=hu&&hu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EWr=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PWr=hu&&hu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OWr(e,t,r);return EWr(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.RetrieveFileOut$=hu.RetrieveFileOut$outboundSchema=hu.RetrieveFileOut$inboundSchema=void 0;hu.retrieveFileOutToJSON=MWr;hu.retrieveFileOutFromJSON=AWr;var Fl=PWr(ge()),ePt=Ee(),TWr=de(),tPt=x8(),rPt=C8(),nPt=O8();hu.RetrieveFileOut$inboundSchema=Fl.object({id:Fl.string(),object:Fl.string(),bytes:Fl.number().int(),created_at:Fl.number().int(),filename:Fl.string(),purpose:tPt.FilePurpose$inboundSchema,sample_type:rPt.SampleType$inboundSchema,num_lines:Fl.nullable(Fl.number().int()).optional(),source:nPt.Source$inboundSchema,deleted:Fl.boolean()}).transform(t=>(0,ePt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));hu.RetrieveFileOut$outboundSchema=Fl.object({id:Fl.string(),object:Fl.string(),sizeBytes:Fl.number().int(),createdAt:Fl.number().int(),filename:Fl.string(),purpose:tPt.FilePurpose$outboundSchema,sampleType:rPt.SampleType$outboundSchema,numLines:Fl.nullable(Fl.number().int()).optional(),source:nPt.Source$outboundSchema,deleted:Fl.boolean()}).transform(t=>(0,ePt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var QEt;(function(t){t.inboundSchema=hu.RetrieveFileOut$inboundSchema,t.outboundSchema=hu.RetrieveFileOut$outboundSchema})(QEt||(hu.RetrieveFileOut$=QEt={}));function MWr(t){return JSON.stringify(hu.RetrieveFileOut$outboundSchema.parse(t))}function AWr(t){return(0,TWr.safeParse)(t,e=>hu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var sPt=b(mu=>{"use strict";var RWr=mu&&mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IWr=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DWr=mu&&mu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RWr(e,t,r);return IWr(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.Security$=mu.Security$outboundSchema=mu.Security$inboundSchema=void 0;mu.securityToJSON=NWr;mu.securityFromJSON=LWr;var Qte=DWr(ge()),aPt=Ee(),jWr=de();mu.Security$inboundSchema=Qte.object({ApiKey:Qte.string().optional()}).transform(t=>(0,aPt.remap)(t,{ApiKey:"apiKey"}));mu.Security$outboundSchema=Qte.object({apiKey:Qte.string().optional()}).transform(t=>(0,aPt.remap)(t,{apiKey:"ApiKey"}));var iPt;(function(t){t.inboundSchema=mu.Security$inboundSchema,t.outboundSchema=mu.Security$outboundSchema})(iPt||(mu.Security$=iPt={}));function NWr(t){return JSON.stringify(mu.Security$outboundSchema.parse(t))}function LWr(t){return(0,jWr.safeParse)(t,e=>mu.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var cPt=b(po=>{"use strict";var FWr=po&&po.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kWr=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BWr=po&&po.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FWr(e,t,r);return kWr(e,t),e};Object.defineProperty(po,"__esModule",{value:!0});po.UnarchiveFTModelOut$=po.UnarchiveFTModelOut$outboundSchema=po.UnarchiveFTModelOut$inboundSchema=po.UnarchiveFTModelOutObject$=po.UnarchiveFTModelOutObject$outboundSchema=po.UnarchiveFTModelOutObject$inboundSchema=po.UnarchiveFTModelOutObject=void 0;po.unarchiveFTModelOutToJSON=qWr;po.unarchiveFTModelOutFromJSON=UWr;var kC=BWr(ge()),$Wr=de();po.UnarchiveFTModelOutObject={Model:"model"};po.UnarchiveFTModelOutObject$inboundSchema=kC.nativeEnum(po.UnarchiveFTModelOutObject);po.UnarchiveFTModelOutObject$outboundSchema=po.UnarchiveFTModelOutObject$inboundSchema;var uPt;(function(t){t.inboundSchema=po.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=po.UnarchiveFTModelOutObject$outboundSchema})(uPt||(po.UnarchiveFTModelOutObject$=uPt={}));po.UnarchiveFTModelOut$inboundSchema=kC.object({id:kC.string(),object:kC.literal("model").default("model"),archived:kC.boolean().default(!1)});po.UnarchiveFTModelOut$outboundSchema=kC.object({id:kC.string(),object:kC.literal("model").default("model"),archived:kC.boolean().default(!1)});var lPt;(function(t){t.inboundSchema=po.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=po.UnarchiveFTModelOut$outboundSchema})(lPt||(po.UnarchiveFTModelOut$=lPt={}));function qWr(t){return JSON.stringify(po.UnarchiveFTModelOut$outboundSchema.parse(t))}function UWr(t){return(0,$Wr.safeParse)(t,e=>po.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var fPt=b(gu=>{"use strict";var zWr=gu&&gu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HWr=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VWr=gu&&gu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zWr(e,t,r);return HWr(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.UpdateFTModelIn$=gu.UpdateFTModelIn$outboundSchema=gu.UpdateFTModelIn$inboundSchema=void 0;gu.updateFTModelInToJSON=JWr;gu.updateFTModelInFromJSON=GWr;var bS=VWr(ge()),WWr=de();gu.UpdateFTModelIn$inboundSchema=bS.object({name:bS.nullable(bS.string()).optional(),description:bS.nullable(bS.string()).optional()});gu.UpdateFTModelIn$outboundSchema=bS.object({name:bS.nullable(bS.string()).optional(),description:bS.nullable(bS.string()).optional()});var dPt;(function(t){t.inboundSchema=gu.UpdateFTModelIn$inboundSchema,t.outboundSchema=gu.UpdateFTModelIn$outboundSchema})(dPt||(gu.UpdateFTModelIn$=dPt={}));function JWr(t){return JSON.stringify(gu.UpdateFTModelIn$outboundSchema.parse(t))}function GWr(t){return(0,WWr.safeParse)(t,e=>gu.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var bPt=b(yu=>{"use strict";var KWr=yu&&yu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YWr=yu&&yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XWr=yu&&yu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KWr(e,t,r);return YWr(e,t),e};Object.defineProperty(yu,"__esModule",{value:!0});yu.UploadFileOut$=yu.UploadFileOut$outboundSchema=yu.UploadFileOut$inboundSchema=void 0;yu.uploadFileOutToJSON=QWr;yu.uploadFileOutFromJSON=eJr;var fd=XWr(ge()),hPt=Ee(),ZWr=de(),mPt=x8(),gPt=C8(),yPt=O8();yu.UploadFileOut$inboundSchema=fd.object({id:fd.string(),object:fd.string(),bytes:fd.number().int(),created_at:fd.number().int(),filename:fd.string(),purpose:mPt.FilePurpose$inboundSchema,sample_type:gPt.SampleType$inboundSchema,num_lines:fd.nullable(fd.number().int()).optional(),source:yPt.Source$inboundSchema}).transform(t=>(0,hPt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));yu.UploadFileOut$outboundSchema=fd.object({id:fd.string(),object:fd.string(),sizeBytes:fd.number().int(),createdAt:fd.number().int(),filename:fd.string(),purpose:mPt.FilePurpose$outboundSchema,sampleType:gPt.SampleType$outboundSchema,numLines:fd.nullable(fd.number().int()).optional(),source:yPt.Source$outboundSchema}).transform(t=>(0,hPt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var pPt;(function(t){t.inboundSchema=yu.UploadFileOut$inboundSchema,t.outboundSchema=yu.UploadFileOut$outboundSchema})(pPt||(yu.UploadFileOut$=pPt={}));function QWr(t){return JSON.stringify(yu.UploadFileOut$outboundSchema.parse(t))}function eJr(t){return(0,ZWr.safeParse)(t,e=>yu.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var SPt=b(ho=>{"use strict";var tJr=ho&&ho.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rJr=ho&&ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nJr=ho&&ho.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tJr(e,t,r);return rJr(e,t),e};Object.defineProperty(ho,"__esModule",{value:!0});ho.ValidationError$=ho.ValidationError$outboundSchema=ho.ValidationError$inboundSchema=ho.Loc$=ho.Loc$outboundSchema=ho.Loc$inboundSchema=void 0;ho.locToJSON=oJr;ho.locFromJSON=iJr;ho.validationErrorToJSON=aJr;ho.validationErrorFromJSON=sJr;var bu=nJr(ge()),wPt=de();ho.Loc$inboundSchema=bu.union([bu.string(),bu.number().int()]);ho.Loc$outboundSchema=bu.union([bu.string(),bu.number().int()]);var _Pt;(function(t){t.inboundSchema=ho.Loc$inboundSchema,t.outboundSchema=ho.Loc$outboundSchema})(_Pt||(ho.Loc$=_Pt={}));function oJr(t){return JSON.stringify(ho.Loc$outboundSchema.parse(t))}function iJr(t){return(0,wPt.safeParse)(t,e=>ho.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}ho.ValidationError$inboundSchema=bu.object({loc:bu.array(bu.union([bu.string(),bu.number().int()])),msg:bu.string(),type:bu.string()});ho.ValidationError$outboundSchema=bu.object({loc:bu.array(bu.union([bu.string(),bu.number().int()])),msg:bu.string(),type:bu.string()});var vPt;(function(t){t.inboundSchema=ho.ValidationError$inboundSchema,t.outboundSchema=ho.ValidationError$outboundSchema})(vPt||(ho.ValidationError$=vPt={}));function aJr(t){return JSON.stringify(ho.ValidationError$outboundSchema.parse(t))}function sJr(t){return(0,wPt.safeParse)(t,e=>ho.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var fn=b(Me=>{"use strict";var uJr=Me&&Me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ne=Me&&Me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uJr(e,t,r)};Object.defineProperty(Me,"__esModule",{value:!0});Ne(ixt(),Me);Ne(hxt(),Me);Ne(LOe(),Me);Ne(bxt(),Me);Ne(IT(),Me);Ne(FOe(),Me);Ne(kOe(),Me);Ne(Mxt(),Me);Ne($Oe(),Me);Ne(Bxt(),Me);Ne(BOe(),Me);Ne(Vxt(),Me);Ne(Cte(),Me);Ne(oCt(),Me);Ne(cCt(),Me);Ne(_Ct(),Me);Ne(UOe(),Me);Ne(zOe(),Me);Ne(RCt(),Me);Ne(jCt(),Me);Ne(WOe(),Me);Ne(KCt(),Me);Ne(VOe(),Me);Ne(DB(),Me);Ne(XCt(),Me);Ne(QCt(),Me);Ne(HOe(),Me);Ne(SOt(),Me);Ne(POt(),Me);Ne(IOt(),Me);Ne(KOe(),Me);Ne(JOe(),Me);Ne(x8(),Me);Ne(YOe(),Me);Ne(UOt(),Me);Ne(JOt(),Me);Ne(XOt(),Me);Ne(rEt(),Me);Ne(XOe(),Me);Ne(ZOe(),Me);Ne(pEt(),Me);Ne(jOe(),Me);Ne(AOe(),Me);Ne(NOe(),Me);Ne(QOe(),Me);Ne($te(),Me);Ne(POe(),Me);Ne(TOe(),Me);Ne(MEt(),Me);Ne(qte(),Me);Ne(iEe(),Me);Ne(qEt(),Me);Ne(IOe(),Me);Ne(VEt(),Me);Ne(GEt(),Me);Ne(qOe(),Me);Ne(Ste(),Me);Ne(ZEt(),Me);Ne(NB(),Me);Ne(MOe(),Me);Ne(LB(),Me);Ne(DOe(),Me);Ne(oPt(),Me);Ne(C8(),Me);Ne(sPt(),Me);Ne(O8(),Me);Ne(iD(),Me);Ne(ete(),Me);Ne(FB(),Me);Ne(tte(),Me);Ne(kB(),Me);Ne(BB(),Me);Ne(aD(),Me);Ne(w8(),Me);Ne(eEe(),Me);Ne(Ute(),Me);Ne(tEe(),Me);Ne(cPt(),Me);Ne(fPt(),Me);Ne(bPt(),Me);Ne(qB(),Me);Ne(sD(),Me);Ne(SPt(),Me);Ne(rEe(),Me);Ne(zte(),Me)});var EPt=b(kl=>{"use strict";var lJr=kl&&kl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cJr=kl&&kl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CPt=kl&&kl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lJr(e,t,r);return cJr(e,t),e};Object.defineProperty(kl,"__esModule",{value:!0});kl.HTTPValidationError$=kl.HTTPValidationError$outboundSchema=kl.HTTPValidationError$inboundSchema=kl.HTTPValidationError=void 0;var E8=CPt(ge()),OPt=CPt(fn()),P8=class extends Error{constructor(e){let r="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(r),this.data$=e,e.detail!=null&&(this.detail=e.detail),this.name="HTTPValidationError"}};kl.HTTPValidationError=P8;kl.HTTPValidationError$inboundSchema=E8.object({detail:E8.array(OPt.ValidationError$inboundSchema).optional()}).transform(t=>new P8(t));kl.HTTPValidationError$outboundSchema=E8.instanceof(P8).transform(t=>t.data$).pipe(E8.object({detail:E8.array(OPt.ValidationError$outboundSchema).optional()}));var xPt;(function(t){t.inboundSchema=kl.HTTPValidationError$inboundSchema,t.outboundSchema=kl.HTTPValidationError$outboundSchema})(xPt||(kl.HTTPValidationError$=xPt={}))});var zp=b(_S=>{"use strict";var dJr=_S&&_S.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ere=_S&&_S.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dJr(e,t,r)};Object.defineProperty(_S,"__esModule",{value:!0});ere(eOe(),_S);ere(EPt(),_S);ere(vOe(),_S);ere(OOe(),_S)});var MPt=b(BC=>{"use strict";var fJr=BC&&BC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pJr=BC&&BC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aEe=BC&&BC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fJr(e,t,r);return pJr(e,t),e};Object.defineProperty(BC,"__esModule",{value:!0});BC.agentsComplete=_Jr;var hJr=wo(),T8=aEe(So()),mJr=Ee(),gJr=de(),PPt=xo(),yJr=Vn(),TPt=aEe(fn()),bJr=aEe(zp());async function _Jr(t,e,r){let n=(0,gJr.safeParse)(e,_=>TPt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,hJr.encodeJSON)("body",o,{explode:!0}),a=(0,yJr.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,mJr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,PPt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PPt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await T8.match(T8.json(200,TPt.ChatCompletionResponse$inboundSchema),T8.jsonErr(422,bJr.HTTPValidationError$inboundSchema),T8.fail("4XX"),T8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var IPt=b($C=>{"use strict";var vJr=$C&&$C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wJr=$C&&$C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tre=$C&&$C.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vJr(e,t,r);return wJr(e,t),e};Object.defineProperty($C,"__esModule",{value:!0});$C.agentsStream=MJr;var SJr=tre(ge()),xJr=wo(),CJr=b8(),M8=tre(So()),OJr=Ee(),EJr=de(),APt=xo(),PJr=Vn(),RPt=tre(fn()),TJr=tre(zp());async function MJr(t,e,r){let n=(0,EJr.safeParse)(e,_=>RPt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,xJr.encodeJSON)("body",o,{explode:!0}),a=(0,PJr.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,OJr.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,APt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,APt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await M8.match(M8.sse(200,SJr.instanceof(ReadableStream).transform(_=>new CJr.EventStream({stream:_,decoder(S){return RPt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),M8.jsonErr(422,TJr.HTTPValidationError$inboundSchema),M8.fail("4XX"),M8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var jPt=b(rre=>{"use strict";Object.defineProperty(rre,"__esModule",{value:!0});rre.Agents=void 0;var AJr=MPt(),RJr=IPt(),IJr=qp(),DPt=Qh(),sEe=class extends IJr.ClientSDK{async complete(e,r){return(0,DPt.unwrapAsync)((0,AJr.agentsComplete)(this,e,r))}async stream(e,r){return(0,DPt.unwrapAsync)((0,RJr.agentsStream)(this,e,r))}};rre.Agents=sEe});var FPt=b(_u=>{"use strict";var DJr=_u&&_u.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jJr=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NJr=_u&&_u.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DJr(e,t,r);return jJr(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.DeleteModelV1ModelsModelIdDeleteRequest$=_u.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=_u.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;_u.deleteModelV1ModelsModelIdDeleteRequestToJSON=FJr;_u.deleteModelV1ModelsModelIdDeleteRequestFromJSON=kJr;var nre=NJr(ge()),LPt=Ee(),LJr=de();_u.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=nre.object({model_id:nre.string()}).transform(t=>(0,LPt.remap)(t,{model_id:"modelId"}));_u.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=nre.object({modelId:nre.string()}).transform(t=>(0,LPt.remap)(t,{modelId:"model_id"}));var NPt;(function(t){t.inboundSchema=_u.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=_u.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(NPt||(_u.DeleteModelV1ModelsModelIdDeleteRequest$=NPt={}));function FJr(t){return JSON.stringify(_u.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function kJr(t){return(0,LJr.safeParse)(t,e=>_u.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var $Pt=b(vu=>{"use strict";var BJr=vu&&vu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Jr=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qJr=vu&&vu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BJr(e,t,r);return $Jr(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.FilesApiRoutesDeleteFileRequest$=vu.FilesApiRoutesDeleteFileRequest$outboundSchema=vu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;vu.filesApiRoutesDeleteFileRequestToJSON=zJr;vu.filesApiRoutesDeleteFileRequestFromJSON=HJr;var ore=qJr(ge()),BPt=Ee(),UJr=de();vu.FilesApiRoutesDeleteFileRequest$inboundSchema=ore.object({file_id:ore.string()}).transform(t=>(0,BPt.remap)(t,{file_id:"fileId"}));vu.FilesApiRoutesDeleteFileRequest$outboundSchema=ore.object({fileId:ore.string()}).transform(t=>(0,BPt.remap)(t,{fileId:"file_id"}));var kPt;(function(t){t.inboundSchema=vu.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=vu.FilesApiRoutesDeleteFileRequest$outboundSchema})(kPt||(vu.FilesApiRoutesDeleteFileRequest$=kPt={}));function zJr(t){return JSON.stringify(vu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function HJr(t){return(0,UJr.safeParse)(t,e=>vu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var zPt=b(wu=>{"use strict";var VJr=wu&&wu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WJr=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JJr=wu&&wu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VJr(e,t,r);return WJr(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.FilesApiRoutesDownloadFileRequest$=wu.FilesApiRoutesDownloadFileRequest$outboundSchema=wu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;wu.filesApiRoutesDownloadFileRequestToJSON=KJr;wu.filesApiRoutesDownloadFileRequestFromJSON=YJr;var ire=JJr(ge()),UPt=Ee(),GJr=de();wu.FilesApiRoutesDownloadFileRequest$inboundSchema=ire.object({file_id:ire.string()}).transform(t=>(0,UPt.remap)(t,{file_id:"fileId"}));wu.FilesApiRoutesDownloadFileRequest$outboundSchema=ire.object({fileId:ire.string()}).transform(t=>(0,UPt.remap)(t,{fileId:"file_id"}));var qPt;(function(t){t.inboundSchema=wu.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=wu.FilesApiRoutesDownloadFileRequest$outboundSchema})(qPt||(wu.FilesApiRoutesDownloadFileRequest$=qPt={}));function KJr(t){return JSON.stringify(wu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function YJr(t){return(0,GJr.safeParse)(t,e=>wu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var WPt=b(Su=>{"use strict";var XJr=Su&&Su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZJr=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QJr=Su&&Su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XJr(e,t,r);return ZJr(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.FilesApiRoutesGetSignedUrlRequest$=Su.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Su.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Su.filesApiRoutesGetSignedUrlRequestToJSON=tGr;Su.filesApiRoutesGetSignedUrlRequestFromJSON=rGr;var HB=QJr(ge()),VPt=Ee(),eGr=de();Su.FilesApiRoutesGetSignedUrlRequest$inboundSchema=HB.object({file_id:HB.string(),expiry:HB.number().int().default(24)}).transform(t=>(0,VPt.remap)(t,{file_id:"fileId"}));Su.FilesApiRoutesGetSignedUrlRequest$outboundSchema=HB.object({fileId:HB.string(),expiry:HB.number().int().default(24)}).transform(t=>(0,VPt.remap)(t,{fileId:"file_id"}));var HPt;(function(t){t.inboundSchema=Su.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Su.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(HPt||(Su.FilesApiRoutesGetSignedUrlRequest$=HPt={}));function tGr(t){return JSON.stringify(Su.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function rGr(t){return(0,eGr.safeParse)(t,e=>Su.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var YPt=b(Cu=>{"use strict";var nGr=Cu&&Cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oGr=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GPt=Cu&&Cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nGr(e,t,r);return oGr(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.FilesApiRoutesListFilesRequest$=Cu.FilesApiRoutesListFilesRequest$outboundSchema=Cu.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Cu.filesApiRoutesListFilesRequestToJSON=aGr;Cu.filesApiRoutesListFilesRequestFromJSON=sGr;var xu=GPt(ge()),KPt=Ee(),iGr=de(),VB=GPt(fn());Cu.FilesApiRoutesListFilesRequest$inboundSchema=xu.object({page:xu.number().int().default(0),page_size:xu.number().int().default(100),sample_type:xu.nullable(xu.array(VB.SampleType$inboundSchema)).optional(),source:xu.nullable(xu.array(VB.Source$inboundSchema)).optional(),search:xu.nullable(xu.string()).optional(),purpose:xu.nullable(VB.FilePurpose$inboundSchema).optional()}).transform(t=>(0,KPt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Cu.FilesApiRoutesListFilesRequest$outboundSchema=xu.object({page:xu.number().int().default(0),pageSize:xu.number().int().default(100),sampleType:xu.nullable(xu.array(VB.SampleType$outboundSchema)).optional(),source:xu.nullable(xu.array(VB.Source$outboundSchema)).optional(),search:xu.nullable(xu.string()).optional(),purpose:xu.nullable(VB.FilePurpose$outboundSchema).optional()}).transform(t=>(0,KPt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var JPt;(function(t){t.inboundSchema=Cu.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Cu.FilesApiRoutesListFilesRequest$outboundSchema})(JPt||(Cu.FilesApiRoutesListFilesRequest$=JPt={}));function aGr(t){return JSON.stringify(Cu.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function sGr(t){return(0,iGr.safeParse)(t,e=>Cu.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var QPt=b(Ou=>{"use strict";var uGr=Ou&&Ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lGr=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGr=Ou&&Ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uGr(e,t,r);return lGr(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.FilesApiRoutesRetrieveFileRequest$=Ou.FilesApiRoutesRetrieveFileRequest$outboundSchema=Ou.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Ou.filesApiRoutesRetrieveFileRequestToJSON=fGr;Ou.filesApiRoutesRetrieveFileRequestFromJSON=pGr;var are=cGr(ge()),ZPt=Ee(),dGr=de();Ou.FilesApiRoutesRetrieveFileRequest$inboundSchema=are.object({file_id:are.string()}).transform(t=>(0,ZPt.remap)(t,{file_id:"fileId"}));Ou.FilesApiRoutesRetrieveFileRequest$outboundSchema=are.object({fileId:are.string()}).transform(t=>(0,ZPt.remap)(t,{fileId:"file_id"}));var XPt;(function(t){t.inboundSchema=Ou.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Ou.FilesApiRoutesRetrieveFileRequest$outboundSchema})(XPt||(Ou.FilesApiRoutesRetrieveFileRequest$=XPt={}));function fGr(t){return JSON.stringify(Ou.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function pGr(t){return(0,dGr.safeParse)(t,e=>Ou.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var uEe=b(Jg=>{"use strict";var hGr=Jg&&Jg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mGr=Jg&&Jg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gGr=Jg&&Jg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hGr(e,t,r);return mGr(e,t),e};Object.defineProperty(Jg,"__esModule",{value:!0});Jg.blobLikeSchema=void 0;Jg.isBlobLike=eTt;var yGr=gGr(ge());Jg.blobLikeSchema=yGr.custom(eTt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function eTt(t){if(t instanceof Blob)return!0;if(typeof t!="object"||t==null||!(Symbol.toStringTag in t))return!1;let e=t[Symbol.toStringTag];return typeof e!="string"||e!=="Blob"&&e!=="File"?!1:"stream"in t&&typeof t.stream=="function"}});var aTt=b(In=>{"use strict";var bGr=In&&In.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Gr=In&&In.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nTt=In&&In.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bGr(e,t,r);return _Gr(e,t),e};Object.defineProperty(In,"__esModule",{value:!0});In.FilesApiRoutesUploadFileMultiPartBodyParams$=In.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=In.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=In.FileT$=In.FileT$outboundSchema=In.FileT$inboundSchema=void 0;In.fileToJSON=wGr;In.fileFromJSON=SGr;In.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=xGr;In.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=CGr;var Bl=nTt(ge()),oTt=de(),vGr=uEe(),iTt=nTt(fn());In.FileT$inboundSchema=Bl.object({fileName:Bl.string(),content:Bl.union([Bl.instanceof(ReadableStream),Bl.instanceof(Blob),Bl.instanceof(ArrayBuffer),Bl.instanceof(Uint8Array)])});In.FileT$outboundSchema=Bl.object({fileName:Bl.string(),content:Bl.union([Bl.instanceof(ReadableStream),Bl.instanceof(Blob),Bl.instanceof(ArrayBuffer),Bl.instanceof(Uint8Array)])});var tTt;(function(t){t.inboundSchema=In.FileT$inboundSchema,t.outboundSchema=In.FileT$outboundSchema})(tTt||(In.FileT$=tTt={}));function wGr(t){return JSON.stringify(In.FileT$outboundSchema.parse(t))}function SGr(t){return(0,oTt.safeParse)(t,e=>In.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}In.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Bl.object({file:Bl.lazy(()=>In.FileT$inboundSchema),purpose:iTt.FilePurpose$inboundSchema.optional()});In.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Bl.object({file:Bl.lazy(()=>In.FileT$outboundSchema).or(vGr.blobLikeSchema),purpose:iTt.FilePurpose$outboundSchema.optional()});var rTt;(function(t){t.inboundSchema=In.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=In.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(rTt||(In.FilesApiRoutesUploadFileMultiPartBodyParams$=rTt={}));function xGr(t){return JSON.stringify(In.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function CGr(t){return(0,oTt.safeParse)(t,e=>In.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var lTt=b(Eu=>{"use strict";var OGr=Eu&&Eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EGr=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PGr=Eu&&Eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OGr(e,t,r);return EGr(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.JobsApiRoutesBatchCancelBatchJobRequest$=Eu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Eu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Eu.jobsApiRoutesBatchCancelBatchJobRequestToJSON=MGr;Eu.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=AGr;var sre=PGr(ge()),uTt=Ee(),TGr=de();Eu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=sre.object({job_id:sre.string()}).transform(t=>(0,uTt.remap)(t,{job_id:"jobId"}));Eu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=sre.object({jobId:sre.string()}).transform(t=>(0,uTt.remap)(t,{jobId:"job_id"}));var sTt;(function(t){t.inboundSchema=Eu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Eu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(sTt||(Eu.JobsApiRoutesBatchCancelBatchJobRequest$=sTt={}));function MGr(t){return JSON.stringify(Eu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function AGr(t){return(0,TGr.safeParse)(t,e=>Eu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var fTt=b(Pu=>{"use strict";var RGr=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IGr=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DGr=Pu&&Pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RGr(e,t,r);return IGr(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.JobsApiRoutesBatchGetBatchJobRequest$=Pu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Pu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Pu.jobsApiRoutesBatchGetBatchJobRequestToJSON=NGr;Pu.jobsApiRoutesBatchGetBatchJobRequestFromJSON=LGr;var ure=DGr(ge()),dTt=Ee(),jGr=de();Pu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=ure.object({job_id:ure.string()}).transform(t=>(0,dTt.remap)(t,{job_id:"jobId"}));Pu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=ure.object({jobId:ure.string()}).transform(t=>(0,dTt.remap)(t,{jobId:"job_id"}));var cTt;(function(t){t.inboundSchema=Pu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Pu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(cTt||(Pu.JobsApiRoutesBatchGetBatchJobRequest$=cTt={}));function NGr(t){return JSON.stringify(Pu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function LGr(t){return(0,jGr.safeParse)(t,e=>Pu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var yTt=b(Tu=>{"use strict";var FGr=Tu&&Tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kGr=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hTt=Tu&&Tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FGr(e,t,r);return kGr(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.JobsApiRoutesBatchGetBatchJobsRequest$=Tu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Tu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Tu.jobsApiRoutesBatchGetBatchJobsRequestToJSON=$Gr;Tu.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=qGr;var Qi=hTt(ge()),mTt=Ee(),BGr=de(),gTt=hTt(fn());Tu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Qi.object({page:Qi.number().int().default(0),page_size:Qi.number().int().default(100),model:Qi.nullable(Qi.string()).optional(),metadata:Qi.nullable(Qi.record(Qi.any())).optional(),created_after:Qi.nullable(Qi.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Qi.boolean().default(!1),status:Qi.nullable(gTt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,mTt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));Tu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Qi.object({page:Qi.number().int().default(0),pageSize:Qi.number().int().default(100),model:Qi.nullable(Qi.string()).optional(),metadata:Qi.nullable(Qi.record(Qi.any())).optional(),createdAfter:Qi.nullable(Qi.date().transform(t=>t.toISOString())).optional(),createdByMe:Qi.boolean().default(!1),status:Qi.nullable(gTt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,mTt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var pTt;(function(t){t.inboundSchema=Tu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Tu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(pTt||(Tu.JobsApiRoutesBatchGetBatchJobsRequest$=pTt={}));function $Gr(t){return JSON.stringify(Tu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function qGr(t){return(0,BGr.safeParse)(t,e=>Tu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var vTt=b(Mu=>{"use strict";var UGr=Mu&&Mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zGr=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HGr=Mu&&Mu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UGr(e,t,r);return zGr(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Mu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=WGr;Mu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=JGr;var lre=HGr(ge()),_Tt=Ee(),VGr=de();Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=lre.object({model_id:lre.string()}).transform(t=>(0,_Tt.remap)(t,{model_id:"modelId"}));Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=lre.object({modelId:lre.string()}).transform(t=>(0,_Tt.remap)(t,{modelId:"model_id"}));var bTt;(function(t){t.inboundSchema=Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(bTt||(Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=bTt={}));function WGr(t){return JSON.stringify(Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function JGr(t){return(0,VGr.safeParse)(t,e=>Mu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var xTt=b(Au=>{"use strict";var GGr=Au&&Au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KGr=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YGr=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GGr(e,t,r);return KGr(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Au.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=ZGr;Au.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=QGr;var cre=YGr(ge()),STt=Ee(),XGr=de();Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=cre.object({job_id:cre.string()}).transform(t=>(0,STt.remap)(t,{job_id:"jobId"}));Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=cre.object({jobId:cre.string()}).transform(t=>(0,STt.remap)(t,{jobId:"job_id"}));var wTt;(function(t){t.inboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(wTt||(Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=wTt={}));function ZGr(t){return JSON.stringify(Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function QGr(t){return(0,XGr.safeParse)(t,e=>Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var PTt=b(Ru=>{"use strict";var eKr=Ru&&Ru.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tKr=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OTt=Ru&&Ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eKr(e,t,r);return tKr(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Ru.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=nKr;Ru.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=oKr;var ETt=OTt(ge()),rKr=de(),dre=OTt(fn());Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=ETt.union([dre.LegacyJobMetadataOut$inboundSchema,dre.JobOut$inboundSchema]);Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=ETt.union([dre.LegacyJobMetadataOut$outboundSchema,dre.JobOut$outboundSchema]);var CTt;(function(t){t.inboundSchema=Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(CTt||(Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=CTt={}));function nKr(t){return JSON.stringify(Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function oKr(t){return(0,rKr.safeParse)(t,e=>Ru.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var ATt=b(Iu=>{"use strict";var iKr=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aKr=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sKr=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iKr(e,t,r);return aKr(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Iu.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=lKr;Iu.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=cKr;var fre=sKr(ge()),MTt=Ee(),uKr=de();Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=fre.object({job_id:fre.string()}).transform(t=>(0,MTt.remap)(t,{job_id:"jobId"}));Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=fre.object({jobId:fre.string()}).transform(t=>(0,MTt.remap)(t,{jobId:"job_id"}));var TTt;(function(t){t.inboundSchema=Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(TTt||(Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=TTt={}));function lKr(t){return JSON.stringify(Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function cKr(t){return(0,uKr.safeParse)(t,e=>Iu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var jTt=b(Dn=>{"use strict";var dKr=Dn&&Dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fKr=Dn&&Dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pKr=Dn&&Dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dKr(e,t,r);return fKr(e,t),e};Object.defineProperty(Dn,"__esModule",{value:!0});Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Dn.Status$=Dn.Status$outboundSchema=Dn.Status$inboundSchema=Dn.Status=void 0;Dn.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=mKr;Dn.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=gKr;var Oo=pKr(ge()),DTt=Ee(),hKr=de();Dn.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Dn.Status$inboundSchema=Oo.nativeEnum(Dn.Status);Dn.Status$outboundSchema=Dn.Status$inboundSchema;var RTt;(function(t){t.inboundSchema=Dn.Status$inboundSchema,t.outboundSchema=Dn.Status$outboundSchema})(RTt||(Dn.Status$=RTt={}));Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Oo.object({page:Oo.number().int().default(0),page_size:Oo.number().int().default(100),model:Oo.nullable(Oo.string()).optional(),created_after:Oo.nullable(Oo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Oo.boolean().default(!1),status:Oo.nullable(Dn.Status$inboundSchema).optional(),wandb_project:Oo.nullable(Oo.string()).optional(),wandb_name:Oo.nullable(Oo.string()).optional(),suffix:Oo.nullable(Oo.string()).optional()}).transform(t=>(0,DTt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Oo.object({page:Oo.number().int().default(0),pageSize:Oo.number().int().default(100),model:Oo.nullable(Oo.string()).optional(),createdAfter:Oo.nullable(Oo.date().transform(t=>t.toISOString())).optional(),createdByMe:Oo.boolean().default(!1),status:Oo.nullable(Dn.Status$outboundSchema).optional(),wandbProject:Oo.nullable(Oo.string()).optional(),wandbName:Oo.nullable(Oo.string()).optional(),suffix:Oo.nullable(Oo.string()).optional()}).transform(t=>(0,DTt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var ITt;(function(t){t.inboundSchema=Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(ITt||(Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=ITt={}));function mKr(t){return JSON.stringify(Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function gKr(t){return(0,hKr.safeParse)(t,e=>Dn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var FTt=b(Du=>{"use strict";var yKr=Du&&Du.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bKr=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Kr=Du&&Du.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yKr(e,t,r);return bKr(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Du.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=wKr;Du.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=SKr;var pre=_Kr(ge()),LTt=Ee(),vKr=de();Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=pre.object({job_id:pre.string()}).transform(t=>(0,LTt.remap)(t,{job_id:"jobId"}));Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=pre.object({jobId:pre.string()}).transform(t=>(0,LTt.remap)(t,{jobId:"job_id"}));var NTt;(function(t){t.inboundSchema=Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(NTt||(Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$=NTt={}));function wKr(t){return JSON.stringify(Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function SKr(t){return(0,vKr.safeParse)(t,e=>Du.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var $Tt=b(ju=>{"use strict";var xKr=ju&&ju.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CKr=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OKr=ju&&ju.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xKr(e,t,r);return CKr(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;ju.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=PKr;ju.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=TKr;var hre=OKr(ge()),BTt=Ee(),EKr=de();ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=hre.object({model_id:hre.string()}).transform(t=>(0,BTt.remap)(t,{model_id:"modelId"}));ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=hre.object({modelId:hre.string()}).transform(t=>(0,BTt.remap)(t,{modelId:"model_id"}));var kTt;(function(t){t.inboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(kTt||(ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=kTt={}));function PKr(t){return JSON.stringify(ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function TKr(t){return(0,EKr.safeParse)(t,e=>ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var VTt=b(Nu=>{"use strict";var MKr=Nu&&Nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AKr=Nu&&Nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UTt=Nu&&Nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MKr(e,t,r);return AKr(e,t),e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Nu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=IKr;Nu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=DKr;var mre=UTt(ge()),zTt=Ee(),RKr=de(),HTt=UTt(fn());Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=mre.object({model_id:mre.string(),UpdateFTModelIn:HTt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,zTt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=mre.object({modelId:mre.string(),updateFTModelIn:HTt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,zTt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var qTt;(function(t){t.inboundSchema=Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(qTt||(Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=qTt={}));function IKr(t){return JSON.stringify(Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function DKr(t){return(0,RKr.safeParse)(t,e=>Nu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var XTt=b(mo=>{"use strict";var jKr=mo&&mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NKr=mo&&mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GTt=mo&&mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jKr(e,t,r);return NKr(e,t),e};Object.defineProperty(mo,"__esModule",{value:!0});mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=mo.RetrieveModelV1ModelsModelIdGetRequest$=mo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=mo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;mo.retrieveModelV1ModelsModelIdGetRequestToJSON=LKr;mo.retrieveModelV1ModelsModelIdGetRequestFromJSON=FKr;mo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=kKr;mo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=BKr;var Jf=GTt(ge()),KTt=Ee(),YTt=de(),gre=GTt(fn());mo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=Jf.object({model_id:Jf.string()}).transform(t=>(0,KTt.remap)(t,{model_id:"modelId"}));mo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Jf.object({modelId:Jf.string()}).transform(t=>(0,KTt.remap)(t,{modelId:"model_id"}));var WTt;(function(t){t.inboundSchema=mo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=mo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(WTt||(mo.RetrieveModelV1ModelsModelIdGetRequest$=WTt={}));function LKr(t){return JSON.stringify(mo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function FKr(t){return(0,YTt.safeParse)(t,e=>mo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Jf.union([gre.BaseModelCard$inboundSchema.and(Jf.object({type:Jf.literal("base")}).transform(t=>({type:t.type}))),gre.FTModelCard$inboundSchema.and(Jf.object({type:Jf.literal("fine-tuned")}).transform(t=>({type:t.type})))]);mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Jf.union([gre.BaseModelCard$outboundSchema.and(Jf.object({type:Jf.literal("base")}).transform(t=>({type:t.type}))),gre.FTModelCard$outboundSchema.and(Jf.object({type:Jf.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var JTt;(function(t){t.inboundSchema=mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(JTt||(mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=JTt={}));function kKr(t){return JSON.stringify(mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function BKr(t){return(0,YTt.safeParse)(t,e=>mo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Lu=b(Ri=>{"use strict";var $Kr=Ri&&Ri.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sl=Ri&&Ri.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Kr(e,t,r)};Object.defineProperty(Ri,"__esModule",{value:!0});sl(FPt(),Ri);sl($Pt(),Ri);sl(zPt(),Ri);sl(WPt(),Ri);sl(YPt(),Ri);sl(QPt(),Ri);sl(aTt(),Ri);sl(lTt(),Ri);sl(fTt(),Ri);sl(yTt(),Ri);sl(vTt(),Ri);sl(xTt(),Ri);sl(PTt(),Ri);sl(ATt(),Ri);sl(jTt(),Ri);sl(FTt(),Ri);sl($Tt(),Ri);sl(VTt(),Ri);sl(XTt(),Ri)});var QTt=b(qC=>{"use strict";var qKr=qC&&qC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UKr=qC&&qC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lEe=qC&&qC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qKr(e,t,r);return UKr(e,t),e};Object.defineProperty(qC,"__esModule",{value:!0});qC.batchJobsCancel=KKr;var zKr=wo(),yre=lEe(So()),HKr=Ee(),VKr=de(),ZTt=xo(),WKr=Vn(),JKr=lEe(fn()),GKr=lEe(Lu());async function KKr(t,e,r){let n=(0,VKr.safeParse)(e,_=>GKr.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,zKr.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,WKr.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,HKr.compactMap)({Accept:"application/json"})),l=await(0,ZTt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ZTt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await yre.match(yre.json(200,JKr.BatchJobOut$inboundSchema),yre.fail("4XX"),yre.fail("5XX"))(v);return g.ok,g}});var nMt=b(UC=>{"use strict";var YKr=UC&&UC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XKr=UC&&UC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rMt=UC&&UC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YKr(e,t,r);return XKr(e,t),e};Object.defineProperty(UC,"__esModule",{value:!0});UC.batchJobsCreate=r7r;var ZKr=wo(),bre=rMt(So()),QKr=Ee(),e7r=de(),eMt=xo(),t7r=Vn(),tMt=rMt(fn());async function r7r(t,e,r){let n=(0,e7r.safeParse)(e,g=>tMt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,ZKr.encodeJSON)("body",o,{explode:!0}),a=(0,t7r.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,QKr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,eMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,eMt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[v]=await bre.match(bre.json(200,tMt.BatchJobOut$inboundSchema),bre.fail("4XX"),bre.fail("5XX"))(m);return v.ok,v}});var iMt=b(zC=>{"use strict";var n7r=zC&&zC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o7r=zC&&zC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cEe=zC&&zC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n7r(e,t,r);return o7r(e,t),e};Object.defineProperty(zC,"__esModule",{value:!0});zC.batchJobsGet=d7r;var i7r=wo(),_re=cEe(So()),a7r=Ee(),s7r=de(),oMt=xo(),u7r=Vn(),l7r=cEe(fn()),c7r=cEe(Lu());async function d7r(t,e,r){let n=(0,s7r.safeParse)(e,_=>c7r.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,i7r.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,u7r.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,a7r.compactMap)({Accept:"application/json"})),l=await(0,oMt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,oMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await _re.match(_re.json(200,l7r.BatchJobOut$inboundSchema),_re.fail("4XX"),_re.fail("5XX"))(v);return g.ok,g}});var sMt=b(HC=>{"use strict";var f7r=HC&&HC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p7r=HC&&HC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dEe=HC&&HC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f7r(e,t,r);return p7r(e,t),e};Object.defineProperty(HC,"__esModule",{value:!0});HC.batchJobsList=v7r;var h7r=wo(),vre=dEe(So()),m7r=Ee(),g7r=de(),aMt=xo(),y7r=Vn(),b7r=dEe(fn()),_7r=dEe(Lu());async function v7r(t,e,r){let n=(0,g7r.safeParse)(e,_=>_7r.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,y7r.pathToFunc)("/v1/batch/jobs")(),s=(0,h7r.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,m7r.compactMap)({Accept:"application/json"})),l=await(0,aMt.extractSecurity)(t._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:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await vre.match(vre.json(200,b7r.BatchJobsOut$inboundSchema),vre.fail("4XX"),vre.fail("5XX"))(v);return g.ok,g}});var uMt=b(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.MistralJobs=void 0;var w7r=QTt(),S7r=nMt(),x7r=iMt(),C7r=sMt(),O7r=qp(),wre=Qh(),fEe=class extends O7r.ClientSDK{async list(e,r){return(0,wre.unwrapAsync)((0,C7r.batchJobsList)(this,e,r))}async create(e,r){return(0,wre.unwrapAsync)((0,S7r.batchJobsCreate)(this,e,r))}async get(e,r){return(0,wre.unwrapAsync)((0,x7r.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,wre.unwrapAsync)((0,w7r.batchJobsCancel)(this,e,r))}};Sre.MistralJobs=fEe});var lMt=b(xre=>{"use strict";Object.defineProperty(xre,"__esModule",{value:!0});xre.Batch=void 0;var E7r=qp(),P7r=uMt(),pEe=class extends E7r.ClientSDK{get jobs(){return this._jobs??(this._jobs=new P7r.MistralJobs(this._options))}};xre.Batch=pEe});var fMt=b(VC=>{"use strict";var T7r=VC&&VC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M7r=VC&&VC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hEe=VC&&VC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&T7r(e,t,r);return M7r(e,t),e};Object.defineProperty(VC,"__esModule",{value:!0});VC.chatComplete=N7r;var A7r=wo(),A8=hEe(So()),R7r=Ee(),I7r=de(),cMt=xo(),D7r=Vn(),dMt=hEe(fn()),j7r=hEe(zp());async function N7r(t,e,r){let n=(0,I7r.safeParse)(e,_=>dMt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,A7r.encodeJSON)("body",o,{explode:!0}),a=(0,D7r.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,R7r.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,cMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,cMt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await A8.match(A8.json(200,dMt.ChatCompletionResponse$inboundSchema),A8.jsonErr(422,j7r.HTTPValidationError$inboundSchema),A8.fail("4XX"),A8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var mMt=b(WC=>{"use strict";var L7r=WC&&WC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F7r=WC&&WC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cre=WC&&WC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L7r(e,t,r);return F7r(e,t),e};Object.defineProperty(WC,"__esModule",{value:!0});WC.chatStream=V7r;var k7r=Cre(ge()),B7r=wo(),$7r=b8(),R8=Cre(So()),q7r=Ee(),U7r=de(),pMt=xo(),z7r=Vn(),hMt=Cre(fn()),H7r=Cre(zp());async function V7r(t,e,r){let n=(0,U7r.safeParse)(e,_=>hMt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,B7r.encodeJSON)("body",o,{explode:!0}),a=(0,z7r.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,q7r.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,pMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,pMt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await R8.match(R8.sse(200,k7r.instanceof(ReadableStream).transform(_=>new $7r.EventStream({stream:_,decoder(S){return hMt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),R8.jsonErr(422,H7r.HTTPValidationError$inboundSchema),R8.fail("4XX"),R8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var Ore=b(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.getDefaultOptions=vS.defaultOptions=vS.ignoreOverride=void 0;vS.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");vS.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 W7r=t=>typeof t=="string"?{...vS.defaultOptions,name:t}:{...vS.defaultOptions,...t};vS.getDefaultOptions=W7r});var mEe=b(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.getRefs=void 0;var J7r=Ore(),G7r=t=>{let e=(0,J7r.getDefaultOptions)(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};Ere.getRefs=G7r});var kT=b(WB=>{"use strict";Object.defineProperty(WB,"__esModule",{value:!0});WB.setResponseValueAndErrors=WB.addErrorMessage=void 0;function gMt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}WB.addErrorMessage=gMt;function K7r(t,e,r,n,o){t[e]=r,gMt(t,e,n,o)}WB.setResponseValueAndErrors=K7r});var gEe=b(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.parseAnyDef=void 0;function Y7r(){return{}}Pre.parseAnyDef=Y7r});var yEe=b(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.parseArrayDef=void 0;var X7r=ge(),Tre=kT(),Z7r=Fu();function Q7r(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==X7r.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,Z7r.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Tre.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Tre.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Tre.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Tre.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}Mre.parseArrayDef=Q7r});var bEe=b(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.parseBigintDef=void 0;var fD=kT();function eYr(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0,fD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,fD.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,fD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,fD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,fD.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,fD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,fD.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Are.parseBigintDef=eYr});var _Ee=b(Rre=>{"use strict";Object.defineProperty(Rre,"__esModule",{value:!0});Rre.parseBooleanDef=void 0;function tYr(){return{type:"boolean"}}Rre.parseBooleanDef=tYr});var Dre=b(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.parseBrandedDef=void 0;var rYr=Fu();function nYr(t,e){return(0,rYr.parseDef)(t.type._def,e)}Ire.parseBrandedDef=nYr});var vEe=b(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.parseCatchDef=void 0;var oYr=Fu(),iYr=(t,e)=>(0,oYr.parseDef)(t.innerType._def,e);jre.parseCatchDef=iYr});var wEe=b(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.parseDateDef=void 0;var yMt=kT();function bMt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>bMt(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return aYr(t,e)}}Nre.parseDateDef=bMt;var aYr=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":(0,yMt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,yMt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var SEe=b(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.parseDefaultDef=void 0;var sYr=Fu();function uYr(t,e){return{...(0,sYr.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Lre.parseDefaultDef=uYr});var xEe=b(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.parseEffectsDef=void 0;var lYr=Fu();function cYr(t,e){return e.effectStrategy==="input"?(0,lYr.parseDef)(t.schema._def,e):{}}Fre.parseEffectsDef=cYr});var CEe=b(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.parseEnumDef=void 0;function dYr(t){return{type:"string",enum:Array.from(t.values)}}kre.parseEnumDef=dYr});var OEe=b(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.parseIntersectionDef=void 0;var _Mt=Fu(),fYr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function pYr(t,e){let r=[(0,_Mt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,_Mt.parseDef)(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(fYr(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}Bre.parseIntersectionDef=pYr});var EEe=b($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.parseLiteralDef=void 0;function hYr(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}$re.parseLiteralDef=hYr});var qre=b(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.parseStringDef=Sc.zodPatterns=void 0;var pD=kT(),PEe;Sc.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:()=>(PEe===void 0&&(PEe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),PEe),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 mYr(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,pD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,pD.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Gg(r,"email",n.message,e);break;case"format:idn-email":Gg(r,"idn-email",n.message,e);break;case"pattern:zod":Yd(r,Sc.zodPatterns.email,n.message,e);break}break;case"url":Gg(r,"uri",n.message,e);break;case"uuid":Gg(r,"uuid",n.message,e);break;case"regex":Yd(r,n.regex,n.message,e);break;case"cuid":Yd(r,Sc.zodPatterns.cuid,n.message,e);break;case"cuid2":Yd(r,Sc.zodPatterns.cuid2,n.message,e);break;case"startsWith":Yd(r,RegExp(`^${TEe(n.value,e)}`),n.message,e);break;case"endsWith":Yd(r,RegExp(`${TEe(n.value,e)}$`),n.message,e);break;case"datetime":Gg(r,"date-time",n.message,e);break;case"date":Gg(r,"date",n.message,e);break;case"time":Gg(r,"time",n.message,e);break;case"duration":Gg(r,"duration",n.message,e);break;case"length":(0,pD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,pD.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Yd(r,RegExp(TEe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Gg(r,"ipv4",n.message,e),n.version!=="v4"&&Gg(r,"ipv6",n.message,e);break}case"base64url":Yd(r,Sc.zodPatterns.base64url,n.message,e);break;case"jwt":Yd(r,Sc.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Yd(r,Sc.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&Yd(r,Sc.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":Yd(r,Sc.zodPatterns.emoji(),n.message,e);break;case"ulid":{Yd(r,Sc.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Gg(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,pD.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Yd(r,Sc.zodPatterns.base64,n.message,e);break}}break}case"nanoid":Yd(r,Sc.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:(o=>{})(n)}return r}Sc.parseStringDef=mYr;function TEe(t,e){return e.patternStrategy==="escape"?yYr(t):t}var gYr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yYr(t){let e="";for(let r=0;r<t.length;r++)gYr.has(t[r])||(e+="\\"),e+=t[r];return e}function Gg(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):(0,pD.setResponseValueAndErrors)(t,"format",e,r,n)}function Yd(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:vMt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,pD.setResponseValueAndErrors)(t,"pattern",vMt(e,n),r,n)}function vMt(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}});var zre=b(Ure=>{"use strict";Object.defineProperty(Ure,"__esModule",{value:!0});Ure.parseRecordDef=void 0;var I8=ge(),wMt=Fu(),bYr=qre(),_Yr=Dre();function vYr(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===I8.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,wMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,wMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===I8.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,bYr.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===I8.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===I8.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===I8.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,_Yr.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Ure.parseRecordDef=vYr});var MEe=b(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.parseMapDef=void 0;var SMt=Fu(),wYr=zre();function SYr(t,e){if(e.mapStrategy==="record")return(0,wYr.parseRecordDef)(t,e);let r=(0,SMt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,SMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}Hre.parseMapDef=SYr});var AEe=b(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.parseNativeEnumDef=void 0;function xYr(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}Vre.parseNativeEnumDef=xYr});var REe=b(Wre=>{"use strict";Object.defineProperty(Wre,"__esModule",{value:!0});Wre.parseNeverDef=void 0;function CYr(){return{not:{}}}Wre.parseNeverDef=CYr});var IEe=b(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.parseNullDef=void 0;function OYr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Jre.parseNullDef=OYr});var Gre=b(BT=>{"use strict";Object.defineProperty(BT,"__esModule",{value:!0});BT.parseUnionDef=BT.primitiveMappings=void 0;var EYr=Fu();BT.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function PYr(t,e){if(e.target==="openApi3")return xMt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in BT.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=BT.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 xMt(t,e)}BT.parseUnionDef=PYr;var xMt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,EYr.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});var DEe=b(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.parseNullableDef=void 0;var CMt=Fu(),OMt=Gre();function TYr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:OMt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[OMt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,CMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,CMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}Kre.parseNullableDef=TYr});var jEe=b(Yre=>{"use strict";Object.defineProperty(Yre,"__esModule",{value:!0});Yre.parseNumberDef=void 0;var $T=kT();function MYr(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",(0,$T.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,$T.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,$T.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,$T.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,$T.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,$T.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,$T.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,$T.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Yre.parseNumberDef=MYr});var LEe=b(Xre=>{"use strict";Object.defineProperty(Xre,"__esModule",{value:!0});Xre.parseObjectDef=void 0;var AYr=ge(),NEe=Fu();function RYr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,NEe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,NEe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function IYr(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof AYr.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,NEe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:RYr(t,e)};return n.required.length||delete n.required,n}Xre.parseObjectDef=IYr});var FEe=b(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.parseOptionalDef=void 0;var EMt=Fu(),DYr=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,EMt.parseDef)(t.innerType._def,e);let r=(0,EMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};Zre.parseOptionalDef=DYr});var kEe=b(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.parsePipelineDef=void 0;var Qre=Fu(),jYr=(t,e)=>{if(e.pipeStrategy==="input")return(0,Qre.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,Qre.parseDef)(t.out._def,e);let r=(0,Qre.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,Qre.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};ene.parsePipelineDef=jYr});var BEe=b(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.parsePromiseDef=void 0;var NYr=Fu();function LYr(t,e){return(0,NYr.parseDef)(t.type._def,e)}tne.parsePromiseDef=LYr});var $Ee=b(rne=>{"use strict";Object.defineProperty(rne,"__esModule",{value:!0});rne.parseSetDef=void 0;var PMt=kT(),FYr=Fu();function kYr(t,e){let n={type:"array",uniqueItems:!0,items:(0,FYr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,PMt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,PMt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}rne.parseSetDef=kYr});var UEe=b(nne=>{"use strict";Object.defineProperty(nne,"__esModule",{value:!0});nne.parseTupleDef=void 0;var qEe=Fu();function BYr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,qEe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,qEe.parseDef)(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>(0,qEe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}nne.parseTupleDef=BYr});var zEe=b(one=>{"use strict";Object.defineProperty(one,"__esModule",{value:!0});one.parseUndefinedDef=void 0;function $Yr(){return{not:{}}}one.parseUndefinedDef=$Yr});var HEe=b(ine=>{"use strict";Object.defineProperty(ine,"__esModule",{value:!0});ine.parseUnknownDef=void 0;function qYr(){return{}}ine.parseUnknownDef=qYr});var VEe=b(ane=>{"use strict";Object.defineProperty(ane,"__esModule",{value:!0});ane.parseReadonlyDef=void 0;var UYr=Fu(),zYr=(t,e)=>(0,UYr.parseDef)(t.innerType._def,e);ane.parseReadonlyDef=zYr});var Fu=b(sne=>{"use strict";Object.defineProperty(sne,"__esModule",{value:!0});sne.parseDef=void 0;var pn=ge(),HYr=gEe(),VYr=yEe(),WYr=bEe(),JYr=_Ee(),GYr=Dre(),KYr=vEe(),YYr=wEe(),XYr=SEe(),ZYr=xEe(),QYr=CEe(),eXr=OEe(),tXr=EEe(),rXr=MEe(),nXr=AEe(),oXr=REe(),iXr=IEe(),aXr=DEe(),sXr=jEe(),uXr=LEe(),lXr=FEe(),cXr=kEe(),dXr=BEe(),fXr=zre(),pXr=$Ee(),hXr=qre(),mXr=UEe(),gXr=zEe(),yXr=Gre(),bXr=HEe(),_Xr=VEe(),vXr=Ore();function TMt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==vXr.ignoreOverride)return a}if(n&&!r){let a=wXr(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=xXr(t,t.typeName,e);return i&&CXr(t,e,i),o.jsonSchema=i,i}sne.parseDef=TMt;var wXr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:SXr(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},SXr=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},xXr=(t,e,r)=>{switch(e){case pn.ZodFirstPartyTypeKind.ZodString:return(0,hXr.parseStringDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodNumber:return(0,sXr.parseNumberDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodObject:return(0,uXr.parseObjectDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodBigInt:return(0,WYr.parseBigintDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodBoolean:return(0,JYr.parseBooleanDef)();case pn.ZodFirstPartyTypeKind.ZodDate:return(0,YYr.parseDateDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodUndefined:return(0,gXr.parseUndefinedDef)();case pn.ZodFirstPartyTypeKind.ZodNull:return(0,iXr.parseNullDef)(r);case pn.ZodFirstPartyTypeKind.ZodArray:return(0,VYr.parseArrayDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodUnion:case pn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,yXr.parseUnionDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodIntersection:return(0,eXr.parseIntersectionDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodTuple:return(0,mXr.parseTupleDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodRecord:return(0,fXr.parseRecordDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodLiteral:return(0,tXr.parseLiteralDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodEnum:return(0,QYr.parseEnumDef)(t);case pn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,nXr.parseNativeEnumDef)(t);case pn.ZodFirstPartyTypeKind.ZodNullable:return(0,aXr.parseNullableDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodOptional:return(0,lXr.parseOptionalDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodMap:return(0,rXr.parseMapDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodSet:return(0,pXr.parseSetDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodLazy:return TMt(t.getter()._def,r);case pn.ZodFirstPartyTypeKind.ZodPromise:return(0,dXr.parsePromiseDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodNaN:case pn.ZodFirstPartyTypeKind.ZodNever:return(0,oXr.parseNeverDef)();case pn.ZodFirstPartyTypeKind.ZodEffects:return(0,ZYr.parseEffectsDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodAny:return(0,HYr.parseAnyDef)();case pn.ZodFirstPartyTypeKind.ZodUnknown:return(0,bXr.parseUnknownDef)();case pn.ZodFirstPartyTypeKind.ZodDefault:return(0,XYr.parseDefaultDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodBranded:return(0,GYr.parseBrandedDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodReadonly:return(0,_Xr.parseReadonlyDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodCatch:return(0,KYr.parseCatchDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodPipeline:return(0,cXr.parsePipelineDef)(t,r);case pn.ZodFirstPartyTypeKind.ZodFunction:case pn.ZodFirstPartyTypeKind.ZodVoid:case pn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},CXr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var WEe=b(une=>{"use strict";Object.defineProperty(une,"__esModule",{value:!0});une.zodToJsonSchema=void 0;var MMt=Fu(),OXr=mEe(),EXr=(t,e)=>{let r=(0,OXr.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,MMt.parseDef)(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(0,MMt.parseDef)(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};une.zodToJsonSchema=EXr});var AMt=b(Cr=>{"use strict";var PXr=Cr&&Cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sn=Cr&&Cr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PXr(e,t,r)};Object.defineProperty(Cr,"__esModule",{value:!0});Sn(Ore(),Cr);Sn(mEe(),Cr);Sn(kT(),Cr);Sn(Fu(),Cr);Sn(gEe(),Cr);Sn(yEe(),Cr);Sn(bEe(),Cr);Sn(_Ee(),Cr);Sn(Dre(),Cr);Sn(vEe(),Cr);Sn(wEe(),Cr);Sn(SEe(),Cr);Sn(xEe(),Cr);Sn(CEe(),Cr);Sn(OEe(),Cr);Sn(EEe(),Cr);Sn(MEe(),Cr);Sn(AEe(),Cr);Sn(REe(),Cr);Sn(IEe(),Cr);Sn(DEe(),Cr);Sn(jEe(),Cr);Sn(LEe(),Cr);Sn(FEe(),Cr);Sn(kEe(),Cr);Sn(BEe(),Cr);Sn(VEe(),Cr);Sn(zre(),Cr);Sn($Ee(),Cr);Sn(qre(),Cr);Sn(UEe(),Cr);Sn(zEe(),Cr);Sn(Gre(),Cr);Sn(HEe(),Cr);Sn(WEe(),Cr);var TXr=WEe();Cr.default=TXr.zodToJsonSchema});var IMt=b(D8=>{"use strict";Object.defineProperty(D8,"__esModule",{value:!0});D8.transformToChatCompletionRequest=AXr;D8.convertToParsedChatCompletionResponse=RXr;D8.responseFormatFromZodObject=RMt;var MXr=AMt();function AXr(t){let{responseFormat:e,...r}=t,n=RMt(e);return{...r,responseFormat:n}}function RXr(t,e){if(t.choices===void 0||t.choices.length===0)return{...t,choices:t.choices===void 0?void 0:[]};let r=[];for(let n of t.choices)n.message===null||typeof n.message>"u"?r.push({...n,message:void 0}):n.message.content!==null&&typeof n.message.content<"u"&&!Array.isArray(n.message.content)&&r.push({...n,message:{...n.message,parsed:e.safeParse(JSON.parse(n.message.content)).data}});return{...t,choices:r}}function RMt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,MXr.zodToJsonSchema)(t),strict:!0}}}});var NMt=b(cne=>{"use strict";Object.defineProperty(cne,"__esModule",{value:!0});cne.Chat=void 0;var DMt=fMt(),jMt=mMt(),IXr=qp(),lne=Qh(),JEe=IMt(),GEe=class extends IXr.ClientSDK{async parse(e,r){let n=(0,JEe.transformToChatCompletionRequest)(e),o=await(0,lne.unwrapAsync)((0,DMt.chatComplete)(this,n,r));return(0,JEe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,JEe.transformToChatCompletionRequest)(e);return(0,lne.unwrapAsync)((0,jMt.chatStream)(this,n,r))}async complete(e,r){return(0,lne.unwrapAsync)((0,DMt.chatComplete)(this,e,r))}async stream(e,r){return(0,lne.unwrapAsync)((0,jMt.chatStream)(this,e,r))}};cne.Chat=GEe});var kMt=b(JC=>{"use strict";var DXr=JC&&JC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jXr=JC&&JC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KEe=JC&&JC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DXr(e,t,r);return jXr(e,t),e};Object.defineProperty(JC,"__esModule",{value:!0});JC.classifiersModerate=$Xr;var NXr=wo(),j8=KEe(So()),LXr=Ee(),FXr=de(),LMt=xo(),kXr=Vn(),FMt=KEe(fn()),BXr=KEe(zp());async function $Xr(t,e,r){let n=(0,FXr.safeParse)(e,_=>FMt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,NXr.encodeJSON)("body",o,{explode:!0}),a=(0,kXr.pathToFunc)("/v1/moderations")(),s=new Headers((0,LXr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,LMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,LMt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await j8.match(j8.json(200,FMt.ClassificationResponse$inboundSchema),j8.jsonErr(422,BXr.HTTPValidationError$inboundSchema),j8.fail("4XX"),j8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var qMt=b(GC=>{"use strict";var qXr=GC&&GC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UXr=GC&&GC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEe=GC&&GC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qXr(e,t,r);return UXr(e,t),e};Object.defineProperty(GC,"__esModule",{value:!0});GC.classifiersModerateChat=GXr;var zXr=wo(),N8=YEe(So()),HXr=Ee(),VXr=de(),BMt=xo(),WXr=Vn(),$Mt=YEe(fn()),JXr=YEe(zp());async function GXr(t,e,r){let n=(0,VXr.safeParse)(e,_=>$Mt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,zXr.encodeJSON)("body",o,{explode:!0}),a=(0,WXr.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,HXr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,BMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,BMt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await N8.match(N8.json(200,$Mt.ClassificationResponse$inboundSchema),N8.jsonErr(422,JXr.HTTPValidationError$inboundSchema),N8.fail("4XX"),N8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var zMt=b(dne=>{"use strict";Object.defineProperty(dne,"__esModule",{value:!0});dne.Classifiers=void 0;var KXr=kMt(),YXr=qMt(),XXr=qp(),UMt=Qh(),XEe=class extends XXr.ClientSDK{async moderate(e,r){return(0,UMt.unwrapAsync)((0,KXr.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,UMt.unwrapAsync)((0,YXr.classifiersModerateChat)(this,e,r))}};dne.Classifiers=XEe});var WMt=b(KC=>{"use strict";var ZXr=KC&&KC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QXr=KC&&KC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZEe=KC&&KC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZXr(e,t,r);return QXr(e,t),e};Object.defineProperty(KC,"__esModule",{value:!0});KC.embeddingsCreate=iZr;var eZr=wo(),L8=ZEe(So()),tZr=Ee(),rZr=de(),HMt=xo(),nZr=Vn(),VMt=ZEe(fn()),oZr=ZEe(zp());async function iZr(t,e,r){let n=(0,rZr.safeParse)(e,_=>VMt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,eZr.encodeJSON)("body",o,{explode:!0}),a=(0,nZr.pathToFunc)("/v1/embeddings")(),s=new Headers((0,tZr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,HMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,HMt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await L8.match(L8.json(200,VMt.EmbeddingResponse$inboundSchema),L8.jsonErr(422,oZr.HTTPValidationError$inboundSchema),L8.fail("4XX"),L8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var JMt=b(fne=>{"use strict";Object.defineProperty(fne,"__esModule",{value:!0});fne.Embeddings=void 0;var aZr=WMt(),sZr=qp(),uZr=Qh(),QEe=class extends sZr.ClientSDK{async create(e,r){return(0,uZr.unwrapAsync)((0,aZr.embeddingsCreate)(this,e,r))}};fne.Embeddings=QEe});var KMt=b(YC=>{"use strict";var lZr=YC&&YC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cZr=YC&&YC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ePe=YC&&YC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lZr(e,t,r);return cZr(e,t),e};Object.defineProperty(YC,"__esModule",{value:!0});YC.filesDelete=yZr;var dZr=wo(),pne=ePe(So()),fZr=Ee(),pZr=de(),GMt=xo(),hZr=Vn(),mZr=ePe(fn()),gZr=ePe(Lu());async function yZr(t,e,r){let n=(0,pZr.safeParse)(e,_=>gZr.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,dZr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,hZr.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,fZr.compactMap)({Accept:"application/json"})),l=await(0,GMt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,GMt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await pne.match(pne.json(200,mZr.DeleteFileOut$inboundSchema),pne.fail("4XX"),pne.fail("5XX"))(v);return g.ok,g}});var XMt=b(XC=>{"use strict";var bZr=XC&&XC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Zr=XC&&XC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tPe=XC&&XC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bZr(e,t,r);return _Zr(e,t),e};Object.defineProperty(XC,"__esModule",{value:!0});XC.filesDownload=EZr;var vZr=tPe(ge()),wZr=wo(),hne=tPe(So()),SZr=Ee(),xZr=de(),YMt=xo(),CZr=Vn(),OZr=tPe(Lu());async function EZr(t,e,r){let n=(0,xZr.safeParse)(e,_=>OZr.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,wZr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,CZr.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,SZr.compactMap)({Accept:"application/octet-stream"})),l=await(0,YMt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,YMt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await hne.match(hne.stream(200,vZr.instanceof(ReadableStream)),hne.fail("4XX"),hne.fail("5XX"))(v);return g.ok,g}});var eAt=b(ZC=>{"use strict";var PZr=ZC&&ZC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TZr=ZC&&ZC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rPe=ZC&&ZC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PZr(e,t,r);return TZr(e,t),e};Object.defineProperty(ZC,"__esModule",{value:!0});ZC.filesGetSignedUrl=jZr;var ZMt=wo(),mne=rPe(So()),MZr=Ee(),AZr=de(),QMt=xo(),RZr=Vn(),IZr=rPe(fn()),DZr=rPe(Lu());async function jZr(t,e,r){let n=(0,AZr.safeParse)(e,S=>DZr.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,ZMt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,RZr.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,ZMt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,MZr.compactMap)({Accept:"application/json"})),c=await(0,QMt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,QMt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},h=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!h.ok)return h;let m=h.value,v=await t._do(m,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!v.ok)return v;let g=v.value,[_]=await mne.match(mne.json(200,IZr.FileSignedURL$inboundSchema),mne.fail("4XX"),mne.fail("5XX"))(g);return _.ok,_}});var rAt=b(QC=>{"use strict";var NZr=QC&&QC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LZr=QC&&QC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nPe=QC&&QC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NZr(e,t,r);return LZr(e,t),e};Object.defineProperty(QC,"__esModule",{value:!0});QC.filesList=zZr;var FZr=wo(),gne=nPe(So()),kZr=Ee(),BZr=de(),tAt=xo(),$Zr=Vn(),qZr=nPe(fn()),UZr=nPe(Lu());async function zZr(t,e,r){let n=(0,BZr.safeParse)(e,_=>UZr.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,$Zr.pathToFunc)("/v1/files")(),s=(0,FZr.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,kZr.compactMap)({Accept:"application/json"})),l=await(0,tAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tAt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await gne.match(gne.json(200,qZr.ListFilesOut$inboundSchema),gne.fail("4XX"),gne.fail("5XX"))(v);return g.ok,g}});var oAt=b(eO=>{"use strict";var HZr=eO&&eO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VZr=eO&&eO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oPe=eO&&eO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HZr(e,t,r);return VZr(e,t),e};Object.defineProperty(eO,"__esModule",{value:!0});eO.filesRetrieve=ZZr;var WZr=wo(),yne=oPe(So()),JZr=Ee(),GZr=de(),nAt=xo(),KZr=Vn(),YZr=oPe(fn()),XZr=oPe(Lu());async function ZZr(t,e,r){let n=(0,GZr.safeParse)(e,_=>XZr.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,WZr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,KZr.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,JZr.compactMap)({Accept:"application/json"})),l=await(0,nAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,nAt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await yne.match(yne.json(200,YZr.RetrieveFileOut$inboundSchema),yne.fail("4XX"),yne.fail("5XX"))(v);return g.ok,g}});var iAt=b(iPe=>{"use strict";Object.defineProperty(iPe,"__esModule",{value:!0});iPe.isReadableStream=QZr;function QZr(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.getReader=="function"&&typeof e.cancel=="function"&&typeof e.tee=="function"}});var sAt=b(tO=>{"use strict";var eQr=tO&&tO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tQr=tO&&tO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aPe=tO&&tO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eQr(e,t,r);return tQr(e,t),e};Object.defineProperty(tO,"__esModule",{value:!0});tO.filesUpload=cQr;var bne=wo(),rQr=HCe(),_ne=aPe(So()),nQr=Ee(),oQr=de(),aAt=xo(),iQr=Vn(),aQr=aPe(fn()),sQr=aPe(Lu()),uQr=uEe(),lQr=iAt();async function cQr(t,e,r){let n=(0,oQr.safeParse)(e,g=>sQr.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,uQr.isBlobLike)(o.file))(0,bne.appendForm)(i,"file",o.file);else if((0,lQr.isReadableStream)(o.file.content)){let g=await(0,rQr.readableStreamToArrayBuffer)(o.file.content),_=new Blob([g],{type:"application/octet-stream"});(0,bne.appendForm)(i,"file",_)}else(0,bne.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,bne.appendForm)(i,"purpose",o.purpose);let a=(0,iQr.pathToFunc)("/v1/files")(),s=new Headers((0,nQr.compactMap)({Accept:"application/json"})),u=await(0,aAt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,aAt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[v]=await _ne.match(_ne.json(200,aQr.UploadFileOut$inboundSchema),_ne.fail("4XX"),_ne.fail("5XX"))(m);return v.ok,v}});var uAt=b(vne=>{"use strict";Object.defineProperty(vne,"__esModule",{value:!0});vne.Files=void 0;var dQr=KMt(),fQr=XMt(),pQr=eAt(),hQr=rAt(),mQr=oAt(),gQr=sAt(),yQr=qp(),JB=Qh(),sPe=class extends yQr.ClientSDK{async upload(e,r){return(0,JB.unwrapAsync)((0,gQr.filesUpload)(this,e,r))}async list(e,r){return(0,JB.unwrapAsync)((0,hQr.filesList)(this,e,r))}async retrieve(e,r){return(0,JB.unwrapAsync)((0,mQr.filesRetrieve)(this,e,r))}async delete(e,r){return(0,JB.unwrapAsync)((0,dQr.filesDelete)(this,e,r))}async download(e,r){return(0,JB.unwrapAsync)((0,fQr.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,JB.unwrapAsync)((0,pQr.filesGetSignedUrl)(this,e,r))}};vne.Files=sPe});var dAt=b(rO=>{"use strict";var bQr=rO&&rO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Qr=rO&&rO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uPe=rO&&rO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bQr(e,t,r);return _Qr(e,t),e};Object.defineProperty(rO,"__esModule",{value:!0});rO.fimComplete=OQr;var vQr=wo(),F8=uPe(So()),wQr=Ee(),SQr=de(),lAt=xo(),xQr=Vn(),cAt=uPe(fn()),CQr=uPe(zp());async function OQr(t,e,r){let n=(0,SQr.safeParse)(e,_=>cAt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,vQr.encodeJSON)("body",o,{explode:!0}),a=(0,xQr.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,wQr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,lAt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lAt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await F8.match(F8.json(200,cAt.FIMCompletionResponse$inboundSchema),F8.jsonErr(422,CQr.HTTPValidationError$inboundSchema),F8.fail("4XX"),F8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var hAt=b(nO=>{"use strict";var EQr=nO&&nO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PQr=nO&&nO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wne=nO&&nO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EQr(e,t,r);return PQr(e,t),e};Object.defineProperty(nO,"__esModule",{value:!0});nO.fimStream=NQr;var TQr=wne(ge()),MQr=wo(),AQr=b8(),k8=wne(So()),RQr=Ee(),IQr=de(),fAt=xo(),DQr=Vn(),pAt=wne(fn()),jQr=wne(zp());async function NQr(t,e,r){let n=(0,IQr.safeParse)(e,_=>pAt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,MQr.encodeJSON)("body",o,{explode:!0}),a=(0,DQr.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,RQr.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,fAt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,fAt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,v={HttpMeta:{Response:m,Request:p}},[g]=await k8.match(k8.sse(200,TQr.instanceof(ReadableStream).transform(_=>new AQr.EventStream({stream:_,decoder(S){return pAt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),k8.jsonErr(422,jQr.HTTPValidationError$inboundSchema),k8.fail("4XX"),k8.fail("5XX"))(m,{extraFields:v});return g.ok,g}});var gAt=b(Sne=>{"use strict";Object.defineProperty(Sne,"__esModule",{value:!0});Sne.Fim=void 0;var LQr=dAt(),FQr=hAt(),kQr=qp(),mAt=Qh(),lPe=class extends kQr.ClientSDK{async complete(e,r){return(0,mAt.unwrapAsync)((0,LQr.fimComplete)(this,e,r))}async stream(e,r){return(0,mAt.unwrapAsync)((0,FQr.fimStream)(this,e,r))}};Sne.Fim=lPe});var bAt=b(oO=>{"use strict";var BQr=oO&&oO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Qr=oO&&oO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cPe=oO&&oO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BQr(e,t,r);return $Qr(e,t),e};Object.defineProperty(oO,"__esModule",{value:!0});oO.fineTuningJobsCancel=JQr;var qQr=wo(),xne=cPe(So()),UQr=Ee(),zQr=de(),yAt=xo(),HQr=Vn(),VQr=cPe(fn()),WQr=cPe(Lu());async function JQr(t,e,r){let n=(0,zQr.safeParse)(e,_=>WQr.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,qQr.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,HQr.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,UQr.compactMap)({Accept:"application/json"})),l=await(0,yAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,yAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await xne.match(xne.json(200,VQr.DetailedJobOut$inboundSchema),xne.fail("4XX"),xne.fail("5XX"))(v);return g.ok,g}});var vAt=b(iO=>{"use strict";var GQr=iO&&iO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KQr=iO&&iO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dPe=iO&&iO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GQr(e,t,r);return KQr(e,t),e};Object.defineProperty(iO,"__esModule",{value:!0});iO.fineTuningJobsCreate=ren;var YQr=wo(),Cne=dPe(So()),XQr=Ee(),ZQr=de(),_At=xo(),QQr=Vn(),een=dPe(fn()),ten=dPe(Lu());async function ren(t,e,r){let n=(0,ZQr.safeParse)(e,g=>een.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,YQr.encodeJSON)("body",o,{explode:!0}),a=(0,QQr.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,XQr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,_At.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_At.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[v]=await Cne.match(Cne.json(200,ten.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Cne.fail("4XX"),Cne.fail("5XX"))(m);return v.ok,v}});var SAt=b(aO=>{"use strict";var nen=aO&&aO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oen=aO&&aO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fPe=aO&&aO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nen(e,t,r);return oen(e,t),e};Object.defineProperty(aO,"__esModule",{value:!0});aO.fineTuningJobsGet=den;var ien=wo(),One=fPe(So()),aen=Ee(),sen=de(),wAt=xo(),uen=Vn(),len=fPe(fn()),cen=fPe(Lu());async function den(t,e,r){let n=(0,sen.safeParse)(e,_=>cen.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,ien.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,uen.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,aen.compactMap)({Accept:"application/json"})),l=await(0,wAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await One.match(One.json(200,len.DetailedJobOut$inboundSchema),One.fail("4XX"),One.fail("5XX"))(v);return g.ok,g}});var CAt=b(sO=>{"use strict";var fen=sO&&sO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pen=sO&&sO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pPe=sO&&sO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fen(e,t,r);return pen(e,t),e};Object.defineProperty(sO,"__esModule",{value:!0});sO.fineTuningJobsList=ven;var hen=wo(),Ene=pPe(So()),men=Ee(),gen=de(),xAt=xo(),yen=Vn(),ben=pPe(fn()),_en=pPe(Lu());async function ven(t,e,r){let n=(0,gen.safeParse)(e,_=>_en.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,yen.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,hen.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,men.compactMap)({Accept:"application/json"})),l=await(0,xAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,xAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await Ene.match(Ene.json(200,ben.JobsOut$inboundSchema),Ene.fail("4XX"),Ene.fail("5XX"))(v);return g.ok,g}});var EAt=b(uO=>{"use strict";var wen=uO&&uO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sen=uO&&uO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hPe=uO&&uO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wen(e,t,r);return Sen(e,t),e};Object.defineProperty(uO,"__esModule",{value:!0});uO.fineTuningJobsStart=Men;var xen=wo(),Pne=hPe(So()),Cen=Ee(),Oen=de(),OAt=xo(),Een=Vn(),Pen=hPe(fn()),Ten=hPe(Lu());async function Men(t,e,r){let n=(0,Oen.safeParse)(e,_=>Ten.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,xen.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Een.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,Cen.compactMap)({Accept:"application/json"})),l=await(0,OAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,OAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await Pne.match(Pne.json(200,Pen.DetailedJobOut$inboundSchema),Pne.fail("4XX"),Pne.fail("5XX"))(v);return g.ok,g}});var PAt=b(Tne=>{"use strict";Object.defineProperty(Tne,"__esModule",{value:!0});Tne.Jobs=void 0;var Aen=bAt(),Ren=vAt(),Ien=SAt(),Den=CAt(),jen=EAt(),Nen=qp(),B8=Qh(),mPe=class extends Nen.ClientSDK{async list(e,r){return(0,B8.unwrapAsync)((0,Den.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,B8.unwrapAsync)((0,Ren.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,B8.unwrapAsync)((0,Ien.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,B8.unwrapAsync)((0,Aen.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,B8.unwrapAsync)((0,jen.fineTuningJobsStart)(this,e,r))}};Tne.Jobs=mPe});var TAt=b(Mne=>{"use strict";Object.defineProperty(Mne,"__esModule",{value:!0});Mne.FineTuning=void 0;var Len=qp(),Fen=PAt(),gPe=class extends Len.ClientSDK{get jobs(){return this._jobs??(this._jobs=new Fen.Jobs(this._options))}};Mne.FineTuning=gPe});var AAt=b(lO=>{"use strict";var ken=lO&&lO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ben=lO&&lO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yPe=lO&&lO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ken(e,t,r);return Ben(e,t),e};Object.defineProperty(lO,"__esModule",{value:!0});lO.modelsArchive=Wen;var $en=wo(),Ane=yPe(So()),qen=Ee(),Uen=de(),MAt=xo(),zen=Vn(),Hen=yPe(fn()),Ven=yPe(Lu());async function Wen(t,e,r){let n=(0,Uen.safeParse)(e,_=>Ven.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,$en.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,zen.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,qen.compactMap)({Accept:"application/json"})),l=await(0,MAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,MAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await Ane.match(Ane.json(200,Hen.ArchiveFTModelOut$inboundSchema),Ane.fail("4XX"),Ane.fail("5XX"))(v);return g.ok,g}});var IAt=b(cO=>{"use strict";var Jen=cO&&cO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gen=cO&&cO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rne=cO&&cO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jen(e,t,r);return Gen(e,t),e};Object.defineProperty(cO,"__esModule",{value:!0});cO.modelsDelete=rtn;var Ken=wo(),$8=Rne(So()),Yen=Ee(),Xen=de(),RAt=xo(),Zen=Vn(),Qen=Rne(fn()),etn=Rne(zp()),ttn=Rne(Lu());async function rtn(t,e,r){let n=(0,Xen.safeParse)(e,S=>ttn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Ken.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Zen.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Yen.compactMap)({Accept:"application/json"})),l=await(0,RAt.extractSecurity)(t._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:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,g={HttpMeta:{Response:v,Request:h}},[_]=await $8.match($8.json(200,Qen.DeleteModelOut$inboundSchema),$8.jsonErr(422,etn.HTTPValidationError$inboundSchema),$8.fail("4XX"),$8.fail("5XX"))(v,{extraFields:g});return _.ok,_}});var jAt=b(dO=>{"use strict";var ntn=dO&&dO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),otn=dO&&dO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bPe=dO&&dO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ntn(e,t,r);return otn(e,t),e};Object.defineProperty(dO,"__esModule",{value:!0});dO.modelsList=ltn;var q8=bPe(So()),itn=Ee(),DAt=xo(),atn=Vn(),stn=bPe(fn()),utn=bPe(zp());async function ltn(t,e){let r=(0,atn.pathToFunc)("/v1/models")(),n=new Headers((0,itn.compactMap)({Accept:"application/json"})),o=await(0,DAt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,DAt.resolveGlobalSecurity)(i),s={operationID:"list_models_v1_models_get",oAuth2Scopes:[],resolvedSecurity:a,securitySource:t._options.apiKey,retryConfig:e?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:e?.retryCodes||["429","500","502","503","504"]},u=t._createRequest(s,{security:a,method:"GET",baseURL:e?.serverURL,path:r,headers:n,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return u;let l=u.value,c=await t._do(l,{context:s,errorCodes:["422","4XX","5XX"],retryConfig:s.retryConfig,retryCodes:s.retryCodes});if(!c.ok)return c;let d=c.value,f={HttpMeta:{Response:d,Request:l}},[p]=await q8.match(q8.json(200,stn.ModelList$inboundSchema),q8.jsonErr(422,utn.HTTPValidationError$inboundSchema),q8.fail("4XX"),q8.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var FAt=b(fO=>{"use strict";var ctn=fO&&fO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dtn=fO&&fO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Pe=fO&&fO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ctn(e,t,r);return dtn(e,t),e};Object.defineProperty(fO,"__esModule",{value:!0});fO.modelsRetrieve=ytn;var ftn=wo(),U8=_Pe(So()),ptn=Ee(),htn=de(),NAt=xo(),mtn=Vn(),gtn=_Pe(zp()),LAt=_Pe(Lu());async function ytn(t,e,r){let n=(0,htn.safeParse)(e,S=>LAt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,ftn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,mtn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,ptn.compactMap)({Accept:"application/json"})),l=await(0,NAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,NAt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,g={HttpMeta:{Response:v,Request:h}},[_]=await U8.match(U8.json(200,LAt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),U8.jsonErr(422,gtn.HTTPValidationError$inboundSchema),U8.fail("4XX"),U8.fail("5XX"))(v,{extraFields:g});return _.ok,_}});var BAt=b(pO=>{"use strict";var btn=pO&&pO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_tn=pO&&pO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vPe=pO&&pO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&btn(e,t,r);return _tn(e,t),e};Object.defineProperty(pO,"__esModule",{value:!0});pO.modelsUnarchive=Etn;var vtn=wo(),Ine=vPe(So()),wtn=Ee(),Stn=de(),kAt=xo(),xtn=Vn(),Ctn=vPe(fn()),Otn=vPe(Lu());async function Etn(t,e,r){let n=(0,Stn.safeParse)(e,_=>Otn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,vtn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,xtn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,wtn.compactMap)({Accept:"application/json"})),l=await(0,kAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await Ine.match(Ine.json(200,Ctn.UnarchiveFTModelOut$inboundSchema),Ine.fail("4XX"),Ine.fail("5XX"))(v);return g.ok,g}});var UAt=b(hO=>{"use strict";var Ptn=hO&&hO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ttn=hO&&hO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wPe=hO&&hO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ptn(e,t,r);return Ttn(e,t),e};Object.defineProperty(hO,"__esModule",{value:!0});hO.modelsUpdate=jtn;var $At=wo(),Dne=wPe(So()),Mtn=Ee(),Atn=de(),qAt=xo(),Rtn=Vn(),Itn=wPe(fn()),Dtn=wPe(Lu());async function jtn(t,e,r){let n=(0,Atn.safeParse)(e,_=>Dtn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,$At.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,$At.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Rtn.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,Mtn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,qAt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,qAt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let v=m.value,[g]=await Dne.match(Dne.json(200,Itn.FTModelOut$inboundSchema),Dne.fail("4XX"),Dne.fail("5XX"))(v);return g.ok,g}});var zAt=b(jne=>{"use strict";Object.defineProperty(jne,"__esModule",{value:!0});jne.Models=void 0;var Ntn=AAt(),Ltn=IAt(),Ftn=jAt(),ktn=FAt(),Btn=BAt(),$tn=UAt(),qtn=qp(),GB=Qh(),SPe=class extends qtn.ClientSDK{async list(e){return(0,GB.unwrapAsync)((0,Ftn.modelsList)(this,e))}async retrieve(e,r){return(0,GB.unwrapAsync)((0,ktn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,GB.unwrapAsync)((0,Ltn.modelsDelete)(this,e,r))}async update(e,r){return(0,GB.unwrapAsync)((0,$tn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,GB.unwrapAsync)((0,Ntn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,GB.unwrapAsync)((0,Btn.modelsUnarchive)(this,e,r))}};jne.Models=SPe});var HAt=b(Nne=>{"use strict";Object.defineProperty(Nne,"__esModule",{value:!0});Nne.Mistral=void 0;var Utn=qp(),ztn=jPt(),Htn=lMt(),Vtn=NMt(),Wtn=zMt(),Jtn=JMt(),Gtn=uAt(),Ktn=gAt(),Ytn=TAt(),Xtn=zAt(),xPe=class extends Utn.ClientSDK{get models(){return this._models??(this._models=new Xtn.Models(this._options))}get files(){return this._files??(this._files=new Gtn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new Ytn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new Htn.Batch(this._options))}get chat(){return this._chat??(this._chat=new Vtn.Chat(this._options))}get fim(){return this._fim??(this._fim=new Ktn.Fim(this._options))}get agents(){return this._agents??(this._agents=new ztn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new Jtn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new Wtn.Classifiers(this._options))}};Nne.Mistral=xPe});var JAt=b(Gf=>{"use strict";var VAt=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ztn=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WAt=Gf&&Gf.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VAt(e,t,r)},Qtn=Gf&&Gf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VAt(e,t,r);return Ztn(e,t),e};Object.defineProperty(Gf,"__esModule",{value:!0});Gf.files=void 0;WAt(Nee(),Gf);Gf.files=Qtn(HCe());WAt(HAt(),Gf)});var tRt=b((MPe,APe)=>{(function(t,e){typeof MPe=="object"&&typeof APe<"u"?APe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(MPe,function(){"use strict";var t="month",e="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===e?this.add(3*s,t):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var l=this.$utils(),c=!!l.u(u)||u;if(l.p(s)===e){var d=this.quarter()-1;return c?this.month(3*d).startOf(t).startOf("day"):this.month(3*d+2).endOf(t).endOf("day")}return a.bind(this)(s,u)}}})});var UT=b((RPe,IPe)=>{(function(t,e){typeof RPe=="object"&&typeof IPe<"u"?IPe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(RPe,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var F=["th","st","nd","rd"],L=k%100;return"["+k+(F[(L-20)%10]||F[L]||F[0])+"]"}},g=function(k,F,L){var q=String(k);return!q||q.length>=F?k:""+Array(F+1-q.length).join(L)+k},_={s:g,z:function(k){var F=-k.utcOffset(),L=Math.abs(F),q=Math.floor(L/60),U=L%60;return(F<=0?"+":"-")+g(q,2,"0")+":"+g(U,2,"0")},m:function k(F,L){if(F.date()<L.date())return-k(L,F);var q=12*(L.year()-F.year())+(L.month()-F.month()),U=F.clone().add(q,l),G=L-U<0,V=F.clone().add(q+(G?-1:1),l);return+(-(q+(L-U)/(G?U-V:V-U))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},S="en",x={};x[S]=v;var O="$isDayjsObject",T=function(k){return k instanceof N||!(!k||!k[O])},E=function k(F,L,q){var U;if(!F)return S;if(typeof F=="string"){var G=F.toLowerCase();x[G]&&(U=G),L&&(x[G]=L,U=G);var V=F.split("-");if(!U&&V.length>1)return k(V[0])}else{var I=F.name;x[I]=F,U=I}return!q&&U&&(S=U),U||!q&&S},M=function(k,F){if(T(k))return k.clone();var L=typeof F=="object"?F:{};return L.date=k,L.args=arguments,new N(L)},R=_;R.l=E,R.i=T,R.w=function(k,F){return M(k,{locale:F.$L,utc:F.$u,x:F.$x,$offset:F.$offset})};var N=function(){function k(L){this.$L=E(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[O]=!0}var F=k.prototype;return F.parse=function(L){this.$d=function(q){var U=q.date,G=q.utc;if(U===null)return new Date(NaN);if(R.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 I=V[2]-1||0,H=(V[7]||"0").substring(0,3);return G?new Date(Date.UTC(V[1],I,V[3]||1,V[4]||0,V[5]||0,V[6]||0,H)):new Date(V[1],I,V[3]||1,V[4]||0,V[5]||0,V[6]||0,H)}}return new Date(U)}(L),this.init()},F.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()},F.$utils=function(){return R},F.isValid=function(){return this.$d.toString()!==p},F.isSame=function(L,q){var U=M(L);return this.startOf(q)<=U&&U<=this.endOf(q)},F.isAfter=function(L,q){return M(L)<this.startOf(q)},F.isBefore=function(L,q){return this.endOf(q)<M(L)},F.$g=function(L,q,U){return R.u(L)?this[q]:this.set(U,L)},F.unix=function(){return Math.floor(this.valueOf()/1e3)},F.valueOf=function(){return this.$d.getTime()},F.startOf=function(L,q){var U=this,G=!!R.u(q)||q,V=R.p(L),I=function(le,Re){var gt=R.w(U.$u?Date.UTC(U.$y,Re,le):new Date(U.$y,Re,le),U);return G?gt:gt.endOf(s)},H=function(le,Re){return R.w(U.toDate()[le].apply(U.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(Re)),U)},W=this.$W,J=this.$M,re=this.$D,Ae="set"+(this.$u?"UTC":"");switch(V){case d:return G?I(1,0):I(31,11);case l:return G?I(1,J):I(0,J+1);case u:var Y=this.$locale().weekStart||0,Q=(W<Y?W+7:W)-Y;return I(G?re-Q:re+(6-Q),J);case s:case f:return H(Ae+"Hours",0);case a:return H(Ae+"Minutes",1);case i:return H(Ae+"Seconds",2);case o:return H(Ae+"Milliseconds",3);default:return this.clone()}},F.endOf=function(L){return this.startOf(L,!1)},F.$set=function(L,q){var U,G=R.p(L),V="set"+(this.$u?"UTC":""),I=(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],H=G===s?this.$D+(q-this.$W):q;if(G===l||G===d){var W=this.clone().set(f,1);W.$d[I](H),W.init(),this.$d=W.set(f,Math.min(this.$D,W.daysInMonth())).$d}else I&&this.$d[I](H);return this.init(),this},F.set=function(L,q){return this.clone().$set(L,q)},F.get=function(L){return this[R.p(L)]()},F.add=function(L,q){var U,G=this;L=Number(L);var V=R.p(q),I=function(J){var re=M(G);return R.w(re.date(re.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 I(1);if(V===u)return I(7);var H=(U={},U[i]=e,U[a]=r,U[o]=t,U)[V]||1,W=this.$d.getTime()+L*H;return R.w(W,this)},F.subtract=function(L,q){return this.add(-1*L,q)},F.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=R.z(this),I=this.$H,H=this.$m,W=this.$M,J=U.weekdays,re=U.months,Ae=U.meridiem,Y=function(Re,gt,Se,ae){return Re&&(Re[gt]||Re(q,G))||Se[gt].slice(0,ae)},Q=function(Re){return R.s(I%12||12,Re,"0")},le=Ae||function(Re,gt,Se){var ae=Re<12?"AM":"PM";return Se?ae.toLowerCase():ae};return G.replace(m,function(Re,gt){return gt||function(Se){switch(Se){case"YY":return String(q.$y).slice(-2);case"YYYY":return R.s(q.$y,4,"0");case"M":return W+1;case"MM":return R.s(W+1,2,"0");case"MMM":return Y(U.monthsShort,W,re,3);case"MMMM":return Y(re,W);case"D":return q.$D;case"DD":return R.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return Y(U.weekdaysMin,q.$W,J,2);case"ddd":return Y(U.weekdaysShort,q.$W,J,3);case"dddd":return J[q.$W];case"H":return String(I);case"HH":return R.s(I,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return le(I,H,!0);case"A":return le(I,H,!1);case"m":return String(H);case"mm":return R.s(H,2,"0");case"s":return String(q.$s);case"ss":return R.s(q.$s,2,"0");case"SSS":return R.s(q.$ms,3,"0");case"Z":return V}return null}(Re)||V.replace(":","")})},F.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},F.diff=function(L,q,U){var G,V=this,I=R.p(q),H=M(L),W=(H.utcOffset()-this.utcOffset())*e,J=this-H,re=function(){return R.m(V,H)};switch(I){case d:G=re()/12;break;case l:G=re();break;case c:G=re()/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/e;break;case o:G=J/t;break;default:G=J}return U?G:R.a(G)},F.daysInMonth=function(){return this.endOf(l).$D},F.$locale=function(){return x[this.$L]},F.locale=function(L,q){if(!L)return this.$L;var U=this.clone(),G=E(L,q,!0);return G&&(U.$L=G),U},F.clone=function(){return R.w(this.$d,this)},F.toDate=function(){return new Date(this.valueOf())},F.toJSON=function(){return this.isValid()?this.toISOString():null},F.toISOString=function(){return this.$d.toISOString()},F.toString=function(){return this.$d.toUTCString()},k}(),j=N.prototype;return M.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(k){j[k[1]]=function(F){return this.$g(F,k[0],k[1])}}),M.extend=function(k,F){return k.$i||(k(F,N,M),k.$i=!0),M},M.locale=E,M.isDayjs=T,M.unix=function(k){return M(1e3*k)},M.en=x[S],M.Ls=x,M.p={},M})});var f1t=C(()=>{tE()});var p1t=C(()=>{Vh();f1t();sx();uC()});var h1t=C(()=>{iE()});var jTe=C(()=>{uC();MA();sx();p1t();h1t()});var jLt=b((x4o,DLt)=>{"use strict";var yln="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";DLt.exports=yln});var kLt=b((C4o,FLt)=>{"use strict";var bln=jLt();function NLt(){}function LLt(){}LLt.resetWarningCache=NLt;FLt.exports=function(){function t(n,o,i,a,s,u){if(u!==bln){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:LLt,resetWarningCache:NLt};return r.PropTypes=r,r}});var $Lt=b((P4o,BLt)=>{BLt.exports=kLt()();var O4o,E4o});var WLt=b(mAe=>{"use strict";mAe.__esModule=!0;mAe.default=function(t,e){if(t&&e){var r=Array.isArray(e)?e:e.split(",");if(r.length===0)return!0;var n=t.name||"",o=(t.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return r.some(function(a){var s=a.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?i===s.replace(/\/.*$/,""):o===s})}return!0}});var jmn={};nf(jmn,{default:()=>wae});module.exports=ml(jmn);iE();MA();sx();var ile=t=>t.map(e=>e.pageContent).join(`
`);var qi={},kWt=0;function AA(t,e){let r=`atom${++kWt}`,n={toString(){return(qi.env?qi.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=BWt,n.write=$Wt),e&&(n.write=e),n}function BWt(t){return t(this)}function $Wt(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var $Fe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,ale=t=>"init"in t,sle=t=>!!t.write,k5=new WeakMap,lle=t=>{var e;return cle(t)&&!((e=k5.get(t))!=null&&e[1])},qWt=(t,e)=>{let r=k5.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((qi.env?qi.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},UWt=t=>{if(k5.has(t))return;let e=[new Set,!1];k5.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},cle=t=>typeof t?.then=="function",qFe=t=>"v"in t||"e"in t,F5=t=>{if("e"in t)throw t.e;if((qi.env?qi.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},HFe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},UFe=(t,e,r,n,o)=>{var i;if((qi.env?qi.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),lle(r.v)&&HFe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&zWt(t,n,e)},zj=()=>[new Map,new Map,new Set],ule=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},zWt=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},HWt=(t,e)=>t[0].get(e),zFe=(t,e)=>{t[2].add(e)},lE=t=>{let e,r=!1,n=o=>{try{o()}catch(i){r||(e=i,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();let o=new Set(t[1].values());t[1].clear();let i=new Set(t[2]);t[2].clear(),o.forEach(a=>{var s;return(s=a.m)==null?void 0:s.l.forEach(n)}),i.forEach(n)}if(r)throw e},VFe=(...[t,e,r,n])=>{let o;(qi.env?qi.env.MODE:void 0)!=="production"&&(o=new Set);let i=(S,x,O)=>{let T="v"in x,E=x.v,M=lle(x.v)?x.v:null;if(cle(O)){UWt(O);for(let R of x.d.keys())HFe(S,O,t(R));x.v=O,delete x.e}else x.v=O,delete x.e;(!T||!Object.is(E,x.v))&&(++x.n,M&&qWt(M,O))},a=(S,x,O)=>{var T;let E=t(x);if(qFe(E)&&(E.m&&!O?.has(x)||Array.from(E.d).every(([F,L])=>a(S,F,O).n===L)))return E;E.d.clear();let M=!0,R=F=>{if($Fe(x,F)){let q=t(F);if(!qFe(q))if(ale(F))i(F,q,F.init);else throw new Error("no atom init");return F5(q)}let L=a(S,F,O);try{return F5(L)}finally{if(M)UFe(S,x,E,F,L);else{let q=zj();UFe(q,x,E,F,L),p(q,x,E),lE(q)}}},N,j,k={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(qi.env?qi.env.MODE:void 0)!=="production"&&!sle(x)&&console.warn("setSelf function cannot be used with read-only atom"),!j&&sle(x)&&(j=(...F)=>{if((qi.env?qi.env.MODE:void 0)!=="production"&&M&&console.warn("setSelf function cannot be called in sync"),!M)return f(x,...F)}),j}};try{let F=e(x,R,k);if(i(x,E,F),cle(F)){(T=F.onCancel)==null||T.call(F,()=>N?.abort());let L=()=>{if(E.m){let q=zj();p(q,x,E),lE(q)}};F.then(L,L)}return E}catch(F){return delete E.v,E.e=F,++E.n,E}finally{M=!1}},s=S=>F5(a(void 0,S)),u=(S,x,O)=>{var T,E;let M=new Map;for(let R of((T=O.m)==null?void 0:T.t)||[])M.set(R,t(R));for(let R of O.p)M.set(R,t(R));return(E=HWt(S,x))==null||E.forEach(R=>{M.set(R,t(R))}),M};function l(S,x,O){let T=[],E=new Set,M=new Set,R=[[x,O]];for(;R.length>0;){let[N,j]=R[R.length-1];if(M.has(N)){R.pop();continue}if(E.has(N)){T.push([N,j,j.n]),M.add(N),R.pop();continue}E.add(N);for(let[k,F]of u(S,N,j))N!==k&&!E.has(k)&&R.push([k,F])}return[T,M]}let c=(S,x,O)=>{let[T,E]=l(S,x,O),M=new Set([x]);for(let R=T.length-1;R>=0;--R){let[N,j,k]=T[R],F=!1;for(let L of j.d.keys())if(L!==N&&M.has(L)){F=!0;break}F&&(a(S,N,E),p(S,N,j),k!==j.n&&(ule(S,N,j),M.add(N))),E.delete(N)}},d=(S,x,...O)=>{let T=!0,E=R=>F5(a(S,R)),M=(R,...N)=>{let j=t(R);try{if($Fe(x,R)){if(!ale(R))throw new Error("atom not writable");let k=j.n,F=N[0];i(R,j,F),p(S,R,j),k!==j.n&&(ule(S,R,j),c(S,R,j));return}else return d(S,R,...N)}finally{T||lE(S)}};try{return r(x,E,M,...O)}finally{T=!1}},f=(S,...x)=>{let O=zj();try{return d(O,S,...x)}finally{lE(O)}},p=(S,x,O)=>{if(O.m&&!lle(O.v)){for(let T of O.d.keys())O.m.d.has(T)||(h(S,T,t(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,t(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,t(T)).t.add(x);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(qi.env?qi.env.MODE:void 0)!=="production"&&o.add(x),sle(x)){let T=O.m,E,M=(R,N)=>{let j=!0;E=(...k)=>{try{return d(R,x,...k)}finally{j||lE(R)}};try{return N()}finally{j=!1}};zFe(S,()=>{let R=M(S,()=>n(x,(...N)=>E(...N)));R&&(T.u=N=>M(N,R))})}}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=t(T).m)==null?void 0:E.d.has(x)})){let T=O.m.u;T&&zFe(S,()=>T(S)),delete O.m,(qi.env?qi.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of O.d.keys()){let M=m(S,E,t(E));M?.t.delete(x)}return}return O.m},_={get:s,set:f,sub:(S,x)=>{let O=zj(),T=t(S),M=h(O,S,T).l;return M.add(x),lE(O),()=>{M.delete(x);let R=zj();m(R,S,T),lE(R)}},unstable_derive:S=>VFe(...S(t,e,r,n))};return(qi.env?qi.env.MODE:void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:x=>{let O=t(x);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let O=zj();for(let[T,E]of x)if(ale(T)){let M=t(T),R=M.n;i(T,M,E),p(O,T,M),R!==M.n&&(ule(O,T,M),c(O,T,M))}lE(O)}}),_},B5=()=>{let t=new WeakMap;return VFe(r=>{if((qi.env?qi.env.MODE:void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var o;return(o=r.onMount)==null?void 0:o.call(r,...n)})},iU,WFe=()=>(iU||(iU=B5(),(qi.env?qi.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=iU),globalThis.__JOTAI_DEFAULT_STORE__!==iU&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),iU);var Wc=B(Z(),1);var z5={},aJt=(0,Wc.createContext)(void 0),ake=t=>{let e=(0,Wc.useContext)(aJt);return t?.store||e||WFe()};var yle=t=>typeof t?.then=="function",ske=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},sJt=Wc.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(ske(t),t)}),gle=new WeakMap,ike=t=>{let e=gle.get(t);return e||(e=new Promise((r,n)=>{let o=t,i=u=>l=>{o===u&&r(l)},a=u=>l=>{o===u&&n(l)},s=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(l=>{if((z5.env?z5.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");yle(l)?(gle.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),gle.set(t,e)),e};function ble(t,e){let r=ake(e),[[n,o,i],a]=(0,Wc.useReducer)(l=>{let c=r.get(t);return Object.is(l[0],c)&&l[1]===r&&l[2]===t?l:[c,r,t]},void 0,()=>[r.get(t),r,t]),s=n;(o!==r||i!==t)&&(a(),s=r.get(t));let u=e?.delay;if((0,Wc.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);yle(c)&&ske(ike(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Wc.useDebugValue)(s),yle(s)){let l=ike(s);return sJt(l)}return s}function uJt(t,e){let r=ake(e);return(0,Wc.useCallback)((...o)=>{if((z5.env?z5.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function _le(t,e){return[ble(t,e),uJt(t,e)]}var dp=B5(),RA=AA(ux);function cE(t){let e=lJt({...me(),...t});dp.set(RA,e)}function Ft(t,e){let r=me();cE({...r,[t]:e})}function me(){return dp.get(RA)}function lke(){let t={...ux,activeModels:dE.map(e=>({...e,enabled:!0})),activeEmbeddingModels:sU.map(e=>({...e,enabled:!0}))};cE(t)}function bl(t){return dp.sub(RA,t)}function Fa(){return ble(RA,{store:dp})}function cke(t){let e=t||ux;e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=sU.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?ux.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?ux.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?ux.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?ux.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?ux.embeddingBatchSize:s,r}function IA(){let t=me().userSystemPrompt;return t?`${vle}
${t}`:vle}function lJt(t){return t.activeModels=uke(t.activeModels,dE),t.activeEmbeddingModels=uke(t.activeEmbeddingModels,sU),t}function an(t){return`${t.name}|${t.provider}`}function uke(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(an(n),{...n})}),t.forEach(n=>{let o=an(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}function hr(...t){me().debug&&console.log(...t)}function Mo(...t){me().debug&&console.error(...t)}var Cle=B(dke()),fp=require("obsidian"),Sle={INVALID_LICENSE_KEY_USER:"Invalid Copilot Plus license key. Please check your license key in settings.",UNKNOWN_ERROR:"An unknown error occurred",REQUEST_FAILED:t=>`Request failed, status ${t}`};function H5(t){let e=t?.json?.detail||t?.json||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function cJt(t){let e=H5(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function fke(t){let e=H5(t);return cJt(t)?Sle.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:Sle.UNKNOWN_ERROR)}var Ole=(t,e)=>{let r=t.getMarkdownFiles();if(e==="/")return r;let n=e.toLowerCase().replace(/^\/|\/$/g,"");return r.filter(o=>{let a=o.path.toLowerCase().split("/"),s=n.split("/"),u=0;for(let l of s){for(;u<a.length&&a[u]!==l;)u++;if(u>=a.length)return!1}return!0})};function Wj(t){return t.replace(/^#/,"").trim().toLowerCase()}function uU(t,e=!0){let r=app.metadataCache.getFileCache(t),n=r?.frontmatter?.tags,o=new Set;if(!e){let i=r?.tags?.map(a=>a.tag);i&&i.forEach(a=>o.add(Wj(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(Wj(i))}):typeof n=="string"&&o.add(Wj(n))),Array.from(o)}function pke(t,e,r){if(e.length===0)return[];e=e.map(i=>Wj(i));let n=r&&r.length>0?r:Ole(t,"/"),o=[];for(let i of n){let a=uU(i);e.some(s=>a.includes(s))&&o.push(i)}return o}var dJt=t=>t.last.bound.modelName||t.last.bound.model,fJt=t=>t.last.bound.retriever!==void 0,hke=t=>dJt(t)||fJt(t);var ys=(t,e="local")=>{let r=(0,Cle.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};function Ele(t){let e=(0,Cle.default)(t,"YYYY/MM/DD HH:mm:ss");return e.isValid()?{fileName:e.format("YYYYMMDD_HHmmss"),display:e.format("YYYY/MM/DD HH:mm:ss"),epoch:e.valueOf()}:ys(new Date)}async function Jj(t,e){return t.extension!="md"?null:await e.cachedRead(t)}function V5(t){return t.basename}function mke(t,e){return!t||!e?!1:t.includes(xle)&&e.includes(xle)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function Gj(t){let e=[],{history:r}=t;for(let n=0;n<r.length;n+=2){let o=r[n]?.content||"",i=r[n+1]?.content||"";e.push([o,i])}return e}function Ry(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r),o=new Map;return n&&n.forEach(i=>{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof fp.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(Ple(a,e)?o.set(l[0].path,l[0]):console.warn(`Found multiple files with title "${a}". Expected a full path for duplicate titles.`))}}),Array.from(o.values())}function Ple(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function gke(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function yke(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}var bke=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;function _ke(t){return bke.test(t)}function lU(t){let e=t.match(bke);return e?e[0]:null}var lx=class{static async isImageUrl(e){try{let r=new URL(e);if(this.IMAGE_EXTENSIONS.some(a=>r.pathname.toLowerCase().endsWith(a)))return!0;try{if((await Kl(e,{method:"HEAD",headers:{}})).headers.get("content-type")?.startsWith("image/"))return!0}catch(a){console.debug("Error checking content-type:",a)}let n=r.searchParams;return[n.has("w")||n.has("width"),n.has("h")||n.has("height"),n.has("format"),n.has("fit"),n.has("q")||n.has("quality"),r.pathname.includes("/image/"),r.pathname.includes("/images/"),r.pathname.includes("/img/"),n.has("auto"),n.has("crop")].filter(Boolean).length>=2}catch(r){return console.error("Error checking if URL is image:",r),!1}}static async convertToBase64(e,r){return{type:"image_url",image_url:{url:await this.imageToBase64(e,r)}}}static async imageToBase64(e,r){return e.startsWith("data:")?e:e.startsWith("app://")?await this.handleLocalImage(e,r):await this.handleWebImage(e)}static async handleLocalImage(e,r){let n=decodeURIComponent(e.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof fp.TFile))throw new Error(`Local image not found: ${n}`);let i=await r.readBinary(o),s=Buffer.from(i).toString("base64");return`data:${`image/${o.extension}`};base64,${s}`}static async handleWebImage(e){try{let r=await Kl(e,{method:"GET",headers:{}});if(!r.ok)throw new Error(`Failed to fetch image: ${r.statusText}`);let n=r.headers.get("content-type");if(!n?.startsWith("image/"))throw new Error(`Invalid content type: ${n}`);let o=await r.arrayBuffer(),a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){throw console.error("Error converting image to base64:",r),r}}};lx.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp",".svg"];async function Kl(t,e={}){let r=e.headers?{...e.headers}:{};if(delete r["content-length"],typeof e.body=="string"){let a=JSON.parse(e.body??{});delete a.frequency_penalty,e.body=JSON.stringify(a)}hr("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,fp.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error(Sle.REQUEST_FAILED(i.status));if(s.json=a,a?.detail?.reason==="Invalid license key"||a?.reason==="Invalid license key")s.message="Invalid license key";else if(a?.detail?.message||a?.message){let u=a?.detail?.message||a?.message,l=a?.detail?.reason||a?.reason;s.message=l?`${u}: ${l}`:u}else a?.detail&&(s.message=JSON.stringify(a.detail));throw s}return{ok:i.status>=200&&i.status<300,status:i.status,statusText:i.status.toString(),headers:new Headers(i.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:pJt(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 pJt(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ia(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function Tle(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function vke(t,e){let[r,n]=t.split("|"),o=e.find(i=>i.name===r&&i.provider===n);if(!o)throw new Error(`No model configuration found for: ${t}`);return o}function DA(t){let e=J5[t];return{...e,label:e.label||t}}function Zm(t,e){let r=J5[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function cU(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new fp.Notice("No active leaf found.");return}if(r.view instanceof fp.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof fp.MarkdownView)){new fp.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to");e?n.replaceRange(t,o,i):n.replaceRange(t,i),new fp.Notice("Message inserted into the active note.")}function wke(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function Ske(t,e){let r=t.split(".").map(Number),n=e.split(".").map(Number);for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function xke(){try{return{version:(await(0,fp.requestUrl)({url:"https://api.github.com/repos/logancyang/obsidian-copilot/releases/latest",method:"GET"})).json.tag_name.replace("v",""),error:null}}catch(t){return{version:null,error:t instanceof Error?t.message:"Failed to check for updates"}}}function jA(t){if(typeof t=="string")return t.startsWith("o1")||t.startsWith("o3");let e=t.modelName||t.model||"";return e.startsWith("o1")||e.startsWith("o3")}function Cke(t,e="system"){return jA(t)?"human":e}function Mle(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(J5).filter(([e])=>!t.includes(e)).map(([e])=>e)}function W5(t,e){let r=!!Mle().find(i=>i===t.provider),n=pE[t.provider],o=!t.apiKey&&!e[n];return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function Kj(t){return t.replace(/<think>[\s\S]*?<\/think>/g,"").trim()}var dU=class{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=ai.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return dU.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=dU.instances.get("llm_chain");return r||(r=dU.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,s=`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:`,u=gs.fromTemplate(s),l=`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`,c=gs.fromTemplate(l),d=v=>v.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=ai.from([{question:v=>(n&&console.log("Input Question: ",v.question),v.question),chat_history:v=>{let g=d(v.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new D5,v=>{let g=Kj(v);return n&&console.log("Standalone Question: ",g),g}]),p=async v=>(r(v),ile(v)),h=ai.from([{context:i.pipe(p),question:new $i,system_message:()=>a},c,o]);return f.pipe(h)}},G5=dU;G5.instances=new Map;var K5=G5;var LA="https://api.brevilabs.com/v1",_l="copilot-chat-view",Ao="user",Iy="ai",vle=`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. Always respond in the language of the user's query.
11. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.`,Y5=`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.`,Oke=6e3,Ale=.4,Eke=.4,Rle=15,Ile=448e3,cx={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},hE={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"};var NA=(f=>(f.OPENAI="openai",f.AZURE_OPENAI="azure openai",f.ANTHROPIC="anthropic",f.COHEREAI="cohereai",f.GOOGLE="google",f.OPENROUTERAI="openrouterai",f.GROQ="groq",f.OLLAMA="ollama",f.LM_STUDIO="lm-studio",f.OPENAI_FORMAT="3rd party (openai-format)",f.COPILOT_PLUS="copilot-plus",f.MISTRAL="mistralai",f))(NA||{});var mE={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},dE=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!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}],fE=(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))(fE||{});var sU=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!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}],xle="nomic-embed-text",J5={["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"},["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:""}},pE={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey"};var Pke=["NEVER","ON STARTUP","ON MODE SWITCH"];var te={ADD_CUSTOM_PROMPT:"add-custom-prompt",APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",APPLY_CUSTOM_PROMPT:"apply-custom-prompt",CHANGE_TONE:"change-tone-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",ELI5:"eli5-prompt",EMOJIFY:"emojify-prompt",FIND_RELEVANT_NOTES:"find-relevant-notes",FIX_GRAMMAR:"fix-grammar-prompt",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",GENERATE_GLOSSARY:"generate-glossary-prompt",GENERATE_TOC:"generate-toc-prompt",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",MAKE_LONGER:"make-longer-prompt",MAKE_SHORTER:"make-shorter-prompt",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",PRESS_RELEASE:"press-release-prompt",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",REMOVE_URLS:"remove-urls-prompt",REWRITE_TWEET:"rewrite-tweet-prompt",REWRITE_TWEET_THREAD:"rewrite-tweet-thread-prompt",SEARCH_ORAMA_DB:"copilot-search-orama-db",SIMPLIFY:"simplify-prompt",SUMMARIZE:"summarize-prompt",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window",TRANSLATE:"translate-selection-prompt"},Dy={[te.ADD_CUSTOM_PROMPT]:"Add custom prompt",[te.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[te.APPLY_CUSTOM_PROMPT]:"Apply custom prompt",[te.CHANGE_TONE]:"Change tone of selection",[te.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[te.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[te.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[te.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[te.DELETE_CUSTOM_PROMPT]:"Delete custom prompt",[te.EDIT_CUSTOM_PROMPT]:"Edit custom prompt",[te.ELI5]:"Explain selection like I'm 5",[te.EMOJIFY]:"Emojify selection",[te.FIND_RELEVANT_NOTES]:"Find relevant notes",[te.FIX_GRAMMAR]:"Fix grammar and spelling of selection",[te.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[te.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[te.GENERATE_GLOSSARY]:"Generate glossary for selection",[te.GENERATE_TOC]:"Generate table of contents for selection",[te.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[te.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[te.LIST_INDEXED_FILES]:"List all indexed files (debug)",[te.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[te.MAKE_LONGER]:"Make selection longer",[te.MAKE_SHORTER]:"Make selection shorter",[te.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[te.PRESS_RELEASE]:"Rewrite selection to a press release",[te.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[te.REMOVE_URLS]:"Remove URLs from selection",[te.REWRITE_TWEET]:"Rewrite selection to a tweet",[te.REWRITE_TWEET_THREAD]:"Rewrite selection to a tweet thread",[te.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[te.SIMPLIFY]:"Simplify selection",[te.SUMMARIZE]:"Summarize selection",[te.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[te.TRANSLATE]:"Translate selection"},X5=[te.FIX_GRAMMAR,te.SUMMARIZE,te.GENERATE_TOC,te.GENERATE_GLOSSARY,te.SIMPLIFY,te.EMOJIFY,te.REMOVE_URLS,te.REWRITE_TWEET,te.REWRITE_TWEET_THREAD,te.MAKE_SHORTER,te.MAKE_LONGER,te.ELI5,te.PRESS_RELEASE,te.TRANSLATE,te.CHANGE_TONE],Tke=[te.SUMMARIZE,te.FIX_GRAMMAR,te.SIMPLIFY,te.EMOJIFY,te.MAKE_LONGER,te.MAKE_SHORTER,te.TRANSLATE],rEn=[te.FIX_GRAMMAR,te.SUMMARIZE,te.GENERATE_TOC,te.GENERATE_GLOSSARY,te.SIMPLIFY,te.EMOJIFY,te.REMOVE_URLS,te.REWRITE_TWEET,te.REWRITE_TWEET_THREAD,te.MAKE_SHORTER,te.MAKE_LONGER,te.ELI5,te.PRESS_RELEASE,te.TRANSLATE,te.CHANGE_TONE],ux={isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",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:"",mistralApiKey:"",activeModels:dE,activeEmbeddingModels:sU,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,enabledCommands:{},promptUsageTimestamps:{},defaultConversationNoteName:"{$topic}@{$date}_{$time}"},dx={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change"};var Rke=require("obsidian"),Z5=null;function fU(){return Rke.Platform.isDesktop&&Z5||(Z5=require("electron")?.remote?.safeStorage),Z5}var Dle="enc_desk_",jle="enc_web_",Lle="enc_",e9="dec_",hJt=new TextEncoder().encode("obsidian-copilot-v1"),Q5={name:"AES-GCM",iv:new Uint8Array(12)};async function Nle(){return await crypto.subtle.importKey("raw",hJt,Q5.name,!1,["encrypt","decrypt"])}async function Ike(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey");for(let n of r){let o=t[n];e[n]=await Mke(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await Mke(n.apiKey||"")})))),e}async function Mke(t){if(!t||t.startsWith(Lle))return t;Dke(t)&&(t=t.replace(e9,""));try{if(fU()?.isEncryptionAvailable()){let o=fU().encryptString(t);return Dle+o.toString("base64")}let e=await Nle(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Q5,e,r);return jle+gJt(n)}catch(e){return console.error("Encryption failed:",e),t}}async function Qo(t){if(!t||mJt(t))return t;if(Dke(t))return t.replace(e9,"");if(t.startsWith(Dle)){let r=t.replace(Dle,""),n=Buffer.from(r,"base64");return fU().decryptString(n)}if(t.startsWith(jle)){let r=t.replace(jle,""),n=await Nle(),o=Ake(r),i=await crypto.subtle.decrypt(Q5,n,o);return new TextDecoder().decode(i)}let e=t.replace(Lle,"");try{if(fU()?.isEncryptionAvailable())try{let i=Buffer.from(e,"base64");return fU().decryptString(i)}catch{}let r=await Nle(),n=Ake(e),o=await crypto.subtle.decrypt(Q5,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function mJt(t){return!t.startsWith(Lle)&&!t.startsWith(e9)}function Dke(t){return t.startsWith(e9)}function gJt(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return window.btoa(r)}function Ake(t){let e=window.atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer}var jke=AA(null),t9=AA(t=>{let e=t(jke);return e!==null?e:t(RA).defaultModelKey},(t,e,r)=>{e(jke,r)}),Nke=AA(null),r9=AA(t=>{let e=t(Nke);return e!==null?e:t(RA).defaultChainType},(t,e,r)=>{e(Nke,r)});function n9(t){dp.set(t9,t)}function o9(){return dp.get(t9)}function Lke(t){return dp.sub(t9,t)}function i9(){return _le(t9,{store:dp})}function eg(){return dp.get(r9)}function Yj(t){dp.set(r9,t)}function Fke(t){return dp.sub(r9,t)}function jy(){return _le(r9,{store:dp})}var zy=B(Z()),OUe=require("obsidian"),EUe=B(lg());var PW=B(Z());var Ql=B(Z(),1);var iUe=B(Z(),1);function bKt(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Xde(...t){return e=>t.forEach(r=>bKt(r,e))}function Vo(...t){return iUe.useCallback(Xde(...t),t)}var EN=B(dt(),1),qy=Ql.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ql.Children.toArray(r),i=o.find(EKt);if(i){let a=i.props.children,s=o.map(u=>u===i?Ql.Children.count(a)>1?Ql.Children.only(null):Ql.isValidElement(a)?a.props.children:null:u);return(0,EN.jsx)(Zde,{...n,ref:e,children:Ql.isValidElement(a)?Ql.cloneElement(a,void 0,s):null})}return(0,EN.jsx)(Zde,{...n,ref:e,children:r})});qy.displayName="Slot";var Zde=Ql.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ql.isValidElement(r)){let o=TKt(r);return Ql.cloneElement(r,{...PKt(n,r.props),ref:e?Xde(e,o):o})}return Ql.Children.count(r)>1?Ql.Children.only(null):null});Zde.displayName="SlotClone";var OKt=({children:t})=>(0,EN.jsx)(EN.Fragment,{children:t});function EKt(t){return Ql.isValidElement(t)&&t.type===OKt}function PKt(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function TKt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function lUe(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=lUe(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function EW(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=lUe(t))&&(n&&(n+=" "),n+=e);return n}var cUe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,dUe=EW,PN=(t,e)=>r=>{var n;if(e?.variants==null)return dUe(t,r?.class,r?.className);let{variants:o,defaultVariants:i}=e,a=Object.keys(o).map(l=>{let c=r?.[l],d=i?.[l];if(c===null)return null;let f=cUe(c)||cUe(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(h=>{let[m,v]=h;return Array.isArray(v)?v.includes({...i,...s}[m]):{...i,...s}[m]===v})?[...l,d,f]:l},[]);return dUe(t,a,u,r?.class,r?.className)};var tfe="-",MKt=t=>{let e=RKt(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(tfe);return s[0]===""&&s.length!==1&&s.shift(),gUe(s,e)||AKt(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},gUe=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?gUe(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(tfe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},fUe=/^\[(.+)\]$/,AKt=t=>{if(fUe.test(t)){let e=fUe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},RKt=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return DKt(Object.entries(t.classGroups),r).forEach(([i,a])=>{efe(a,n,i,e)}),n},efe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:pUe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(IKt(o)){efe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{efe(a,pUe(e,i),r,n)})})},pUe=(t,e)=>{let r=t;return e.split(tfe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},IKt=t=>t.isThemeGetter,DKt=(t,e)=>e?t.map(([r,n])=>{let o=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[e+a,s])):i);return[r,o]}):t,jKt=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map,o=(i,a)=>{r.set(i,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return o(i,a),a},set(i,a){r.has(i)?r.set(i,a):o(i,a)}}},yUe="!",NKt=t=>{let{separator:e,experimentalParseClassName:r}=t,n=e.length===1,o=e[0],i=e.length,a=s=>{let u=[],l=0,c=0,d;for(let v=0;v<s.length;v++){let g=s[v];if(l===0){if(g===o&&(n||s.slice(v,v+i)===e)){u.push(s.slice(c,v)),c=v+i;continue}if(g==="/"){d=v;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(yUe),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},LKt=t=>{if(t.length<=1)return t;let e=[],r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},FKt=t=>({cache:jKt(t.cacheSize),parseClassName:NKt(t),...MKt(t)}),kKt=/\s+/,BKt=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(kKt),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=Boolean(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 v=LKt(c).join(":"),g=d?v+yUe:v,_=g+m;if(i.includes(_))continue;i.push(_);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 $Kt(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=bUe(e))&&(n&&(n+=" "),n+=r);return n}var bUe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=bUe(t[n]))&&(r&&(r+=" "),r+=e);return r};function hUe(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=FKt(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=BKt(u,r);return o(u,c),c}return function(){return i($Kt.apply(null,arguments))}}var Si=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},_Ue=/^\[(?:([a-z-]+):)?(.+)\]$/i,qKt=/^\d+\/\d+$/,UKt=new Set(["px","full","screen"]),zKt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HKt=/\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$/,VKt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,WKt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,JKt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sx=t=>TN(t)||UKt.has(t)||qKt.test(t),FE=t=>MN(t,"length",t7t),TN=t=>Boolean(t)&&!Number.isNaN(Number(t)),Qde=t=>MN(t,"number",TN),oz=t=>Boolean(t)&&Number.isInteger(Number(t)),GKt=t=>t.endsWith("%")&&TN(t.slice(0,-1)),Tr=t=>_Ue.test(t),kE=t=>zKt.test(t),KKt=new Set(["length","size","percentage"]),YKt=t=>MN(t,KKt,vUe),XKt=t=>MN(t,"position",vUe),ZKt=new Set(["image","url"]),QKt=t=>MN(t,ZKt,n7t),e7t=t=>MN(t,"",r7t),iz=()=>!0,MN=(t,e,r)=>{let n=_Ue.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},t7t=t=>HKt.test(t)&&!VKt.test(t),vUe=()=>!1,r7t=t=>WKt.test(t),n7t=t=>JKt.test(t);var mUe=()=>{let t=Si("colors"),e=Si("spacing"),r=Si("blur"),n=Si("brightness"),o=Si("borderColor"),i=Si("borderRadius"),a=Si("borderSpacing"),s=Si("borderWidth"),u=Si("contrast"),l=Si("grayscale"),c=Si("hueRotate"),d=Si("invert"),f=Si("gap"),p=Si("gradientColorStops"),h=Si("gradientColorStopPositions"),m=Si("inset"),v=Si("margin"),g=Si("opacity"),_=Si("padding"),S=Si("saturate"),x=Si("scale"),O=Si("sepia"),T=Si("skew"),E=Si("space"),M=Si("translate"),R=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",Tr,e],k=()=>[Tr,e],F=()=>["",Sx,FE],L=()=>["auto",TN,Tr],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"],I=()=>["","0",Tr],H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[TN,Tr];return{cacheSize:500,separator:":",theme:{colors:[iz],spacing:[Sx,FE],blur:["none","",kE,Tr],brightness:W(),borderColor:[t],borderRadius:["none","","full",kE,Tr],borderSpacing:k(),borderWidth:F(),contrast:W(),grayscale:I(),hueRotate:W(),invert:I(),gap:k(),gradientColorStops:[t],gradientColorStopPositions:[GKt,FE],inset:j(),margin:j(),opacity:W(),padding:k(),saturate:W(),scale:W(),sepia:I(),skew:W(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",Tr]}],container:["container"],columns:[{columns:[kE]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"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(),Tr]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],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",oz,Tr]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Tr]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",oz,Tr]}],"grid-cols":[{"grid-cols":[iz]}],"col-start-end":[{col:["auto",{span:["full",oz,Tr]},Tr]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[iz]}],"row-start-end":[{row:["auto",{span:[oz,Tr]},Tr]}],"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",Tr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Tr]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...V()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...V(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...V(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Tr,e]}],"min-w":[{"min-w":[Tr,e,"min","max","fit"]}],"max-w":[{"max-w":[Tr,e,"none","full","min","max","fit","prose",{screen:[kE]},kE]}],h:[{h:[Tr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Tr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Tr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Tr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",kE,FE]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qde]}],"font-family":[{font:[iz]}],"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",Tr]}],"line-clamp":[{"line-clamp":["none",TN,Qde]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sx,Tr]}],"list-image":[{"list-image":["none",Tr]}],"list-style-type":[{list:["none","disc","decimal",Tr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sx,FE]}],"underline-offset":[{"underline-offset":["auto",Sx,Tr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Tr]}],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",Tr]}],"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(),XKt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YKt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},QKt]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[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":[Sx,Tr]}],"outline-w":[{outline:[Sx,FE]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Sx,FE]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",kE,e7t]}],"shadow-color":[{shadow:[iz]}],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",kE,Tr]}],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",Tr]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",Tr]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",Tr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[oz,Tr]}],"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",Tr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Tr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",Tr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sx,FE,Qde]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},o7t=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{az(t,"cacheSize",e),az(t,"prefix",r),az(t,"separator",n),az(t,"experimentalParseClassName",o);for(let s in a)i7t(t[s],a[s]);for(let s in i)a7t(t[s],i[s]);return t},az=(t,e,r)=>{r!==void 0&&(t[e]=r)},i7t=(t,e)=>{if(e)for(let r in e)az(t,r,e[r])},a7t=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},wUe=(t,...e)=>typeof t=="function"?hUe(mUe,t,...e):hUe(()=>o7t(mUe(),t),...e);var s7t=wUe({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 Te(...t){return s7t(EW(t))}var u7t=PN("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"}}),Ge=PW.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>PW.createElement(n?qy:"button",{className:Te(u7t({variant:e,size:r,className:t})),ref:i,...o}));Ge.displayName="Button";var MW=B(Z());var SUe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TW=(...t)=>t.filter((e,r,n)=>Boolean(e)&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();var sz=B(Z());var xUe={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 CUe=(0,sz.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,sz.createElement)("svg",{ref:u,...xUe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:TW("lucide",o),...s},[...a.map(([l,c])=>(0,sz.createElement)(l,c)),...Array.isArray(i)?i:[i]]));var _e=(t,e)=>{let r=(0,MW.forwardRef)(({className:n,...o},i)=>(0,MW.createElement)(CUe,{ref:i,iconNode:e,className:TW(`lucide-${SUe(t)}`,n),...o}));return r.displayName=`${t}`,r};var AN=_e("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);var uz=_e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var lz=_e("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 cg=_e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var Sl=_e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var ZA=_e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var QA=_e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var xl=_e("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 dg=_e("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var BE=_e("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);var cz=_e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var dz=_e("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 fz=_e("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 eR=_e("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 tR=_e("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);var pz=_e("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);var hz=_e("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 mz=_e("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 $E=_e("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 rR=_e("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 gz=_e("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 xx=_e("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 nR=_e("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 yz=_e("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 bz=_e("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 oR=_e("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 _z=_e("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 vz=_e("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 wz=_e("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 Sz=_e("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 iR=_e("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 wf=_e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var xz=_e("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 RN=_e("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);var qE=_e("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 IN=_e("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 aR=_e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var Cz=_e("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 Oz=_e("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 Ez=_e("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 Uy=_e("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);var UE=_e("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 Sf=_e("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 Pz=_e("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 Tz=_e("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 Cx=_e("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 xh=_e("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 Mz=_e("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 sR=_e("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 Ch=_e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function l7t({onCancel:t}){let e=me(),r=rfe(e.defaultModelKey)&&rfe(e.embeddingModelKey);return zy.default.createElement("div",{className:"flex flex-col gap-4"},zy.default.createElement("div",{className:"flex flex-col gap-2"},zy.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&zy.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.")),zy.default.createElement("div",{className:"flex gap-2 justify-end w-full"},zy.default.createElement(Ge,{variant:"ghost",onClick:t},"Close"),zy.default.createElement(Ge,{variant:"default",onClick:()=>{DN(hE.EXPIRED_MODAL)}},"Renew Now ",zy.default.createElement(rR,{className:"size-4"}))))}var AW=class extends OUe.Modal{constructor(r){super(r);this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:r}=this;this.root=(0,EUe.createRoot)(r);let n=()=>{this.close()};this.root.render(zy.default.createElement(l7t,{onCancel:n}))}onClose(){this.root.unmount()}};var ir=class extends Error{constructor(r,n){super(r);this.code=n,Object.setPrototypeOf(this,ir.prototype)}};var pgt=B(l3(),1);hh();xA();uC();hh();hf();function kf(t){return typeof t?.parse=="function"}function uZ(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Bi(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function tk(t,e){let r=typeof e=="number"?void 0:e,n;return Ig(t)?n={type:"function",function:uZ(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}function iNr(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function aNr(t){return t!==void 0&&nn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function sNr(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&kf(t.schema)}function Ig(t){return sNr(t)||aNr(t)||iNr(t)}hh();xA();Aj();c3();tE();hf();Ty();A5();Iq();var ba=class extends ek{constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models",this._llmType()]}),Object.defineProperty(this,"disableStreaming",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=ba._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===ba.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=ba._convertInputToPromptValue(e).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),s={...i.metadata,...this.getLsParams(a)},u=await _i.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(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(Vm)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await _i.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!==ba.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=yl(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 v=a?.at(0)?.runId;v!=null&&m.message._updateId(`run-${v}`)}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,qq,{value:a?{runIds:a?.map(d=>d.runId)}:void 0,configurable:!0}),c}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let a=e.map(v=>v.map(Vm)),s={...i.metadata,...this.getLsParams(o)},u=await _i.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),a,i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(v,g)=>{let _=ba._convertInputToPromptValue(v).toString(),S=await r.lookup(_,n);return S==null&&d.push(g),S}))).map((v,g)=>({result:v,runManager:c?.[g]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),h=[];await Promise.all(p.map(async({result:v,runManager:g},_)=>{if(v.status==="fulfilled"){let S=v.value;return h[_]=S.map(x=>("message"in x&&dh(x.message)&&Gu(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(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let m={generations:h,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(m,qq,{value:c?{runIds:c?.map(v=>v.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(h=>h.map(Vm)),[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,v)=>{let g=d[v];c[g]=m;let _=ba._convertInputToPromptValue(i[g]).toString();return u.update(_,l,m)})),p=h.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(Vm)],r,n)).generations[0][0].message}async callPrompt(e,r,n){let o=e.toChatMessages();return this.call(o,r,n)}async predictMessages(e,r,n){return this.call(e,r,n)}async predict(e,r,n){let o=new Qa(e),i=await this.call([o],r,n);if(typeof i.content!="string")throw new Error("Cannot use predict when output is not a string.");return i.content}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=n.description??"A function available to call.",a=r?.method,s=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let u=o??"extract",l;kf(n)?l=[{type:"function",function:{name:u,description:i,parameters:Bi(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Ym.from(m=>{if(!m.tool_calls||m.tool_calls.length===0)throw new Error("No tool calls found in the response.");let v=m.tool_calls.find(g=>g.name===u);if(!v)throw new Error(`No tool call found with name ${u}.`);return v.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=$i.assign({parsed:(m,v)=>d.invoke(m.raw,v)}),p=$i.assign({parsed:()=>null}),h=f.withFallbacks({fallbacks:[p]});return ai.from([{raw:c},h]).withConfig({runName:"StructuredOutputRunnable"})}};Vh();gA();var fc=[];for(lZ=0;lZ<256;++lZ)fc.push((lZ+256).toString(16).slice(1));var lZ;function lgt(t,e=0){return(fc[t[e+0]]+fc[t[e+1]]+fc[t[e+2]]+fc[t[e+3]]+"-"+fc[t[e+4]]+fc[t[e+5]]+"-"+fc[t[e+6]]+fc[t[e+7]]+"-"+fc[t[e+8]]+fc[t[e+9]]+"-"+fc[t[e+10]]+fc[t[e+11]]+fc[t[e+12]]+fc[t[e+13]]+fc[t[e+14]]+fc[t[e+15]]).toLowerCase()}var cZ,uNr=new Uint8Array(16);function uSe(){if(!cZ&&(cZ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cZ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cZ(uNr)}var lNr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),lSe={randomUUID:lNr};function cNr(t,e,r){if(lSe.randomUUID&&!e&&!t)return lSe.randomUUID();t=t||{};var n=t.random||(t.rng||uSe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return lgt(n)}var cSe=cNr;function cgt(t){let e=[],r=[];typeof t=="string"?r=[{output:t}]:t instanceof Map||typeof t=="object"&&t!==null&&!Array.isArray(t)?r=[t]:Array.isArray(t)||(r=[{output:t}]);for(let n of r)!(n instanceof Map)&&(typeof n!="object"||n===null)&&(n={output:n}),e.push(n);return e}function dZ(t,e){let r=i=>{switch(i){case"system":return"SYSTEM";case"human":return"USER";case"ai":return"CHATBOT";case"tool":return"TOOL";default:throw new Error(`Unknown message type: '${i}'. Accepted types: 'human', 'ai', 'system', 'tool'`)}},n=i=>{if(typeof i=="string")return i;throw new Error(`ChatCohere does not support non text message content. Received: ${JSON.stringify(i,null,2)}`)},o=i=>Gu(i)&&i.tool_calls?i.tool_calls.map(a=>({name:a.name,parameters:a.args})):[];if(t._getType().toLowerCase()==="ai")return{role:r(t._getType()),message:n(t.content),toolCalls:o(t)};if(t._getType().toLowerCase()==="tool")return{role:r(t._getType()),message:n(t.content),toolResults:e};if(t._getType().toLowerCase()==="human"||t._getType().toLowerCase()==="system")return{role:r(t._getType()),message:n(t.content)};throw new Error("Got unknown message type. Supported types are AIMessage, ToolMessage, HumanMessage, and SystemMessage")}function fNr(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function dgt(t){return t._getType()==="tool"}function fgt(t){let e="properties"in t?t.properties:{},r="required"in t?t.required:[],n={};return Object.keys(e).forEach(o=>{n[o]=e[o],r===void 0&&(r=[]),n[o].required=r.includes(o)}),n}function pNr(t){if(t){if(t.every(fNr))return t;if(t.every(Vw))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:fgt(e.function.parameters)}));if(t.every(Ig))return t.map(e=>{let r=Bi(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:fgt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var fZ=class extends ba{static lc_name(){return"ChatCohere"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"command-r-plus"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.3}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey??Yt("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new pgt.CohereClient({token:r}),this.model=e?.model??this.model,this.temperature=e?.temperature??this.temperature,this.streaming=e?.streaming??this.streaming,this.streamUsage=e?.streamUsage??this.streamUsage}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"cohere",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.temperature??void 0,ls_max_tokens:typeof r.maxTokens=="number"?r.maxTokens:void 0,ls_stop:Array.isArray(r.stopSequences)?r.stopSequences:void 0}}_llmType(){return"cohere"}invocationParams(e){if(e.tool_choice)throw new Error("'tool_choice' call option is not supported by ChatCohere.");let r={model:this.model,preamble:e.preamble,conversationId:e.conversationId,promptTruncation:e.promptTruncation,connectors:e.connectors,searchQueriesOnly:e.searchQueriesOnly,documents:e.documents,temperature:e.temperature??this.temperature,forceSingleStep:e.forceSingleStep,tools:e.tools};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}bindTools(e,r){return this.bind({tools:pNr(e),...r})}_getChatRequest(e,r){let n=this.invocationParams(r),o=this._messagesToCohereToolResultsCurrChatTurn(e),i=[],a="",s=[];if(n.forceSingleStep){a="";for(let l=0;l<e.length-1;l+=1){let c=e[l];if(!(Gu(c)&&c.tool_calls))if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=dZ(c,s);i.push(d),s=[]}}else i.push(dZ(c,[]))}for(let l=e.length-1;l>=0;l-=1){let c=e[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l<e.length-1;l+=1){let c=e[l];if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=dZ(c,s);i.push(d),s=[]}}else i.push(dZ(c,[]))}a=o.length>0?"":e[e.length-1].content.toString()}return{message:a,chatHistory:i,toolResults:o.length>0?o:void 0,...n}}_getCurrChatTurnMessages(e){let r=[];for(let n=e.length-1;n>=0;n-=1){let o=e[n];if(r.push(o),o._getType().toLowerCase()==="human")break}return r.reverse()}_messagesToCohereToolResultsCurrChatTurn(e){let r=[],n=this._getCurrChatTurnMessages(e);for(let o of n)if(dgt(o)){let i=o,a=n.filter(s=>Gu(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:cgt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!dgt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Gu(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:cgt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:cSe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let h=p.generationInfo?.completion??0;d[h]===void 0?d[h]=p:d[h]=d[h].concat(p)}return{generations:Object.entries(d).sort(([p],[h])=>parseInt(p,10)-parseInt(h,10)).map(([p,h])=>h),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new To({content:a.text,additional_kwargs:s,tool_calls:u,usage_metadata:{input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens??0}}),generationInfo:s}],llmOutput:{estimatedTokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=this._getChatRequest(e,r),i=await this.caller.call(async()=>{let a;try{a=await this.client.chatStream(o)}catch(s){throw s.status=s.status??s.statusCode,s}return a});for await(let a of i)if(a.eventType==="text-generation")yield new Ho({text:a.text,message:new Dr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new Ho({text:"",message:new Dr({content:"",additional_kwargs:{...a}}),generationInfo:{...a}});else if(a.eventType==="stream-end"&&(this.streamUsage||r.streamUsage)){let s=a.response.meta?.tokens?.inputTokens??0,u=a.response.meta?.tokens?.outputTokens??0,l={...a.response};a.response.toolCalls&&a.response.toolCalls.length>0&&(l.toolCalls=this._formatCohereToolCalls(a.response.toolCalls));let c=[],d=l.toolCalls??[];d.length>0&&(c=d.map(f=>({name:f.function.name,args:f.function.arguments,id:f.id,index:f.index,type:"tool_call_chunk"}))),yield new Ho({text:"",message:new Dr({content:"",additional_kwargs:{eventType:"stream-end"},tool_call_chunks:c,usage_metadata:{input_tokens:s,output_tokens:u,total_tokens:s+u}}),generationInfo:{eventType:"stream-end",...l}})}}_combineLLMOutput(...e){return e.reduce((r,n)=>{if(n&&n.estimatedTokenUsage){let o=r.estimatedTokenUsage?.completionTokens??0,i=r.estimatedTokenUsage?.promptTokens??0,a=r.estimatedTokenUsage?.totalTokens??0;o+=n.estimatedTokenUsage.completionTokens??0,i+=n.estimatedTokenUsage.promptTokens??0,a+=n.estimatedTokenUsage.totalTokens??0,r.estimatedTokenUsage={completionTokens:o,promptTokens:i,totalTokens:a}}return r},{estimatedTokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}};var hNr=B(l3(),1);xA();Aj();tE();c3();Ty();Iq();var mgt=B(l3(),1);Rj();var Ip=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new lp(e??{})}};var Dg=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[]);var pZ=class extends Ip{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"embeddingTypes",{enumerable:!0,configurable:!0,writable:!0,value:["float"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey||Yt("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new mgt.CohereClient({token:n}),this.model=r?.model??this.model,!this.model)throw new Error("Model not specified for CohereEmbeddings instance. Please provide a model name from the options here: https://docs.cohere.com/reference/embed");this.batchSize=r?.batchSize??this.batchSize,this.embeddingTypes=r?.embeddingTypes??this.embeddingTypes}async embedDocuments(e){let r=Dg(e,this.batchSize),n=r.map(a=>this.embeddingWithRetry({model:this.model,texts:a,inputType:"search_document",embeddingTypes:this.embeddingTypes})),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{embeddings:u}=o[a];for(let l=0;l<s.length;l+=1)"float"in u&&u.float?i.push(u.float[l]):Array.isArray(u)&&i.push(u[l])}return i}async embedQuery(e){let{embeddings:r}=await this.embeddingWithRetry({model:this.model,texts:[e],inputType:"search_query",embeddingTypes:this.embeddingTypes});if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embed(e){let{embeddings:r}=await this.embeddingWithRetry(e);if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embeddingWithRetry(e){return this.caller.call(async()=>{let r;try{r=await this.client.embed(e)}catch(n){throw n.status=n.status??n.statusCode,n}return r})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}};var mNr=B(l3(),1);var ggt;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(ggt||(ggt={}));var ygt;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(ygt||(ygt={}));var bgt;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(bgt||(bgt={}));var _gt=["user","model","function","system"],UI;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT"})(UI||(UI={}));var zI;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(zI||(zI={}));var vgt;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(vgt||(vgt={}));var wgt;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(wgt||(wgt={}));var d3;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.OTHER="OTHER"})(d3||(d3={}));var Sgt;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(Sgt||(Sgt={}));var HI;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(HI||(HI={}));var xgt;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(xgt||(xgt={}));var sd=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},KP=class extends sd{constructor(e,r){super(e),this.response=r}},mZ=class extends sd{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},Ww=class extends sd{};var gNr="https://generativelanguage.googleapis.com",yNr="v1beta",bNr="0.21.0",_Nr="genai-js",VI;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(VI||(VI={}));var dSe=class{constructor(e,r,n,o,i){this.model=e,this.task=r,this.apiKey=n,this.stream=o,this.requestOptions=i}toString(){var e,r;let n=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||yNr,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||gNr}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};function vNr(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${_Nr}/${bNr}`),e.join(" ")}async function wNr(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",vNr(t.requestOptions)),r.append("x-goog-api-key",t.apiKey);let n=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(o){throw new 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 SNr(t,e,r,n,o,i){let a=new dSe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},ENr(i)),{method:"POST",headers:await wNr(a),body:o})}}async function h3(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await SNr(t,e,r,n,o,i);return xNr(s,u,a)}async function xNr(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){CNr(o,t)}return n.ok||await ONr(n,t),n}function CNr(t,e){let r=t;throw t instanceof mZ||t instanceof Ww||(r=new sd(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function ONr(t,e){let r="",n;try{let o=await t.json();r=o.error.message,o.error.details&&(r+=` ${JSON.stringify(o.error.details)}`,n=o.error.details)}catch{}throw new mZ(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function ENr(t){let e={};if(t?.signal!==void 0||t?.timeout>=0){let r=new AbortController;t?.timeout>=0&&setTimeout(()=>r.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{r.abort()}),e.signal=r.signal}return e}function pSe(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),hZ(t.candidates[0]))throw new KP(`${YP(t)}`,t);return PNr(t)}else if(t.promptFeedback)throw new KP(`Text not available. ${YP(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),hZ(t.candidates[0]))throw new KP(`${YP(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),Cgt(t)[0]}else if(t.promptFeedback)throw new KP(`Function call not available. ${YP(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),hZ(t.candidates[0]))throw new KP(`${YP(t)}`,t);return Cgt(t)}else if(t.promptFeedback)throw new KP(`Function call not available. ${YP(t)}`,t)},t}function PNr(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
`+a.executableCode.code+"\n```\n"),a.codeExecutionResult&&i.push("\n```\n"+a.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function Cgt(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}var TNr=[d3.RECITATION,d3.SAFETY,d3.LANGUAGE];function hZ(t){return!!t.finishReason&&TNr.includes(t.finishReason)}function YP(t){var e,r,n;let o="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)o+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(o+=` due to ${t.promptFeedback.blockReason}`),!((r=t.promptFeedback)===null||r===void 0)&&r.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((n=t.candidates)===null||n===void 0)&&n[0]){let i=t.candidates[0];hZ(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function f3(t){return this instanceof f3?(this.v=t,this):new f3(t)}function MNr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof f3?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 Ogt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function ANr(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=DNr(e),[n,o]=r.tee();return{stream:INr(n),response:RNr(o)}}async function RNr(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return pSe(jNr(e));e.push(o)}}function INr(t){return MNr(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield f3(r.read());if(o)break;yield yield f3(pSe(n))}})}function DNr(t){let e=t.getReader();return new ReadableStream({start(n){let o="";return i();function i(){return e.read().then(({value:a,done:s})=>{if(s){if(o.trim()){n.error(new sd("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(Ogt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new sd(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(Ogt)}return i()})}}})}function jNr(t){let e=t[t.length-1],r={promptFeedback:e?.promptFeedback};for(let n of t){if(n.candidates)for(let o of n.candidates){let i=o.index;if(r.candidates||(r.candidates=[]),r.candidates[i]||(r.candidates[i]={index:o.index}),r.candidates[i].citationMetadata=o.citationMetadata,r.candidates[i].groundingMetadata=o.groundingMetadata,r.candidates[i].finishReason=o.finishReason,r.candidates[i].finishMessage=o.finishMessage,r.candidates[i].safetyRatings=o.safetyRatings,o.content&&o.content.parts){r.candidates[i].content||(r.candidates[i].content={role:o.content.role||"user",parts:[]});let a={};for(let s of o.content.parts)s.text&&(a.text=s.text),s.functionCall&&(a.functionCall=s.functionCall),s.executableCode&&(a.executableCode=s.executableCode),s.codeExecutionResult&&(a.codeExecutionResult=s.codeExecutionResult),Object.keys(a).length===0&&(a.text=""),r.candidates[i].content.parts.push(a)}}n.usageMetadata&&(r.usageMetadata=n.usageMetadata)}return r}async function Mgt(t,e,r,n){let o=await h3(e,VI.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return ANr(o)}async function Agt(t,e,r,n){let i=await(await h3(e,VI.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:pSe(i)}}function Rgt(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function p3(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(let r of t)typeof r=="string"?e.push({text:r}):e.push(r);return NNr(e)}function NNr(t){let e={role:"user",parts:[]},r={role:"function",parts:[]},n=!1,o=!1;for(let i of t)"functionResponse"in i?(r.parts.push(i),o=!0):(e.parts.push(i),n=!0);if(n&&o)throw new sd("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 sd("No content is provided for sending chat message.");return n?e:r}function LNr(t,e){var r;let n={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(r=e?.cachedContent)===null||r===void 0?void 0:r.name,contents:[]},o=t.generateContentRequest!=null;if(t.contents){if(o)throw new Ww("CountTokensRequest must have one of contents or generateContentRequest, not both.");n.contents=t.contents}else if(o)n=Object.assign(Object.assign({},n),t.generateContentRequest);else{let i=p3(t);n.contents=[i]}return{generateContentRequest:n}}function Egt(t){let e;return t.contents?e=t:e={contents:[p3(t)]},t.systemInstruction&&(e.systemInstruction=Rgt(t.systemInstruction)),e}function FNr(t){return typeof t=="string"||Array.isArray(t)?{content:p3(t)}:t}var Pgt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],kNr={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function BNr(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new sd(`First content should be with role 'user', got ${n}`);if(!_gt.includes(n))throw new sd(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(_gt)}`);if(!Array.isArray(o))throw new sd("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new sd("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 Pgt)u in s&&(i[u]+=1);let a=kNr[n];for(let s of Pgt)if(!a.includes(s)&&i[s]>0)throw new sd(`Content with role '${n}' can't contain '${s}' part`);e=!0}}var Tgt="SILENT_ERROR",fSe=class{constructor(e,r,n,o={}){this.model=r,this.params=n,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,n?.history&&(BNr(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=p3(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f;return this._sendPromise=this._sendPromise.then(()=>Agt(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=YP(p.response);m&&console.warn(`sendMessage() was unsuccessful. ${m}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=p3(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f=Mgt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(Tgt)}).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=YP(p);h&&console.warn(`sendMessageStream() was unsuccessful. ${h}. Inspect response object for details.`)}}).catch(p=>{p.message!==Tgt&&console.error(p)}),f}};async function $Nr(t,e,r,n){return(await h3(e,VI.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function qNr(t,e,r,n){return(await h3(e,VI.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function UNr(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await h3(e,VI.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var gZ=class{constructor(e,r,n={}){this.apiKey=e,this._requestOptions=n,r.model.includes("/")?this.model=r.model:this.model=`models/${r.model}`,this.generationConfig=r.generationConfig||{},this.safetySettings=r.safetySettings||[],this.tools=r.tools,this.toolConfig=r.toolConfig,this.systemInstruction=Rgt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=Egt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return Agt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}async generateContentStream(e,r={}){var n;let o=Egt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return Mgt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}startChat(e){var r;return new fSe(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(r=this.cachedContent)===null||r===void 0?void 0:r.name},e),this._requestOptions)}async countTokens(e,r={}){let n=LNr(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),o=Object.assign(Object.assign({},this._requestOptions),r);return $Nr(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=FNr(e),o=Object.assign(Object.assign({},this._requestOptions),r);return qNr(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return UNr(this.apiKey,this.model,e,n)}};var WI=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new sd("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new gZ(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new Ww("Cached content must contain a `name` field.");if(!e.model)throw new Ww("Cached content must contain a `model` field.");let o=["model","systemInstruction"];for(let a of o)if(r?.[a]&&e[a]&&r?.[a]!==e[a]){if(a==="model"){let s=r.model.startsWith("models/")?r.model.replace("models/",""):r.model,u=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(s===u)continue}throw new Ww(`Different value for "${a}" specified in modelParams (${r[a]}) and cachedContent (${e[a]})`)}let i=Object.assign(Object.assign({},r),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new gZ(this.apiKey,i,n)}};sx();hh();function rk(t){if(typeof t=="object"&&t!==null){let e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema;for(let r in e)r in e&&(Array.isArray(e[r])?e[r]=e[r].map(rk):typeof e[r]=="object"&&e[r]!==null&&(e[r]=rk(e[r])));return e}return t}function yZ(t){let e=rk(Bi(t)),{$schema:r,...n}=e;return n}function Igt(t){let e=rk(t),{$schema:r,...n}=e;return n}Vh();uC();function zNr(t){let e=t._getType();return Gl.isInstance(t)?t.role:e==="tool"?e:t.name??e}function HNr(t){switch(t){case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${t}`)}}function VNr(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function WNr(t,e){if(typeof t.content=="string"&&t.content!=="")return[{text:t.content}];let r=[],n=[],o=[];return"tool_calls"in t&&Array.isArray(t.tool_calls)&&t.tool_calls.length>0?r=t.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}})):t.getType()==="tool"&&t.name&&t.content?n=[{functionResponse:{name:t.name,response:t.content}}]:Array.isArray(t.content)&&(o=t.content.map(i=>{if(i.type==="text")return{text:i.text};if(i.type==="executableCode")return{executableCode:i.executableCode};if(i.type==="codeExecutionResult")return{codeExecutionResult:i.codeExecutionResult};if(i.type==="image_url"){if(!e)throw new Error("This model does not support images");let a;if(typeof i.image_url=="string")a=i.image_url;else if(typeof i.image_url=="object"&&"url"in i.image_url)a=i.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[s,u]=a.split(",");if(!s.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[l,c]=s.replace(/^data:/,"").split(";");if(c!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:u,mimeType:l}}}else{if(i.type==="media")return VNr(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 hSe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!dh(o))throw new Error("Unsupported message input");let a=zNr(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=HNr(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=WNr(o,e);if(n.mergeWithPreviousContent){let f=n.content[n.content.length-1];if(!f)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return f.parts.push(...l),{mergeWithPreviousContent:!1,content:n.content}}let c=s;(c==="function"||c==="system"&&!r)&&(c="user");let d={role:c,parts:l};return{mergeWithPreviousContent:a==="system"&&!r,content:[...n.content,d]}},{content:[],mergeWithPreviousContent:!1}).content}function Dgt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts.length===1&&o.parts[0].text?a=o.parts[0].text:a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l);let s="";return typeof a=="string"?s=a:"text"in a[0]&&(s=a[0].text),{generations:[{text:s,message:new To({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function jgt(t,e){if(!t.candidates||t.candidates.length===0)return null;let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts&&o.parts.every(l=>"text"in l)?a=o.parts.map(l=>l.text).join(""):o.parts&&(a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l));let s="";a&&typeof a=="string"?s=a:a&&typeof a=="object"&&"text"in a[0]&&(s=a[0].text);let u=[];return r&&u.push(...r.map(l=>({...l,args:JSON.stringify(l.args),index:e.index,type:"tool_call_chunk"}))),new Ho({text:s,message:new Dr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function Ngt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Ig(e)){let r=yZ(e.schema);return{name:e.name,description:e.description,parameters:r}}return Vw(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:Igt(e.function.parameters)}:e})}]}iE();var m3=class extends CA{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","google_genai","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new cp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return!("tool_calls"in a)||!Array.isArray(a.tool_calls)?[]:a.tool_calls});if(r[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}};uC();function mSe(t,e){let r=JNr(t),n=KNr(r,e);return{tools:r,toolConfig:n}}function JNr(t){let e=[],r=[];return t.forEach(o=>{if(Ig(o)){let[i]=Ngt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Vw(o)){let{functionDeclarations:i}=GNr(o);if(i)e.push(...i);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else r.push(o)}),r.find(o=>"functionDeclarations"in o)?r.map(o=>{if(e?.length>0&&"functionDeclarations"in o){let i={functionDeclarations:[...o.functionDeclarations||[],...e]};return e=[],i}return o}):[...r,...e.length>0?[{functionDeclarations:e}]:[]]}function GNr(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:rk(t.function.parameters)}]}}function KNr(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:HI.ANY,auto:HI.AUTO,none:HI.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:HI.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var bZ=class extends ba{static lc_name(){return"ChatGoogleGenerativeAI"}get lc_secrets(){return{apiKey:"GOOGLE_API_KEY"}}get lc_aliases(){return{apiKey:"google_api_key"}}get _isMultimodalModel(){return this.model.includes("vision")||this.model.startsWith("gemini-1.5")||this.model.startsWith("gemini-2")}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","google_genai"]}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxOutputTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"safetySettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"convertSystemMessageToHumanContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.model,this.model=this.modelName,this.maxOutputTokens=e?.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=e?.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>1))throw new Error("`temperature` must be in the range of [0.0,1.0]");if(this.topP=e?.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=e?.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=e?.stopSequences??this.stopSequences,this.apiKey=e?.apiKey??Yt("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=e?.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(n=>n.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=e?.streaming??this.streaming,this.client=new WI(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{candidateCount:1,stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...e?.json?{responseMimeType:"application/json"}:{}}},{apiVersion:e?.apiVersion,baseUrl:e?.baseUrl}),this.streamUsage=e?.streamUsage??this.streamUsage}useCachedContent(e,r,n){this.apiKey&&(this.client=new WI(this.apiKey).getGenerativeModelFromCachedContent(e,r,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.modelName==="gemini-1.0-pro-001"||this.modelName.startsWith("gemini-pro-vision")||this.modelName.startsWith("gemini-1.0-pro-vision")?!1:this.modelName!=="gemini-pro"}getLsParams(e){return{ls_provider:"google_genai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.client.generationConfig.temperature,ls_max_tokens:this.client.generationConfig.maxOutputTokens,ls_stop:e.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(e,r){return this.bind({tools:mSe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?mSe(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(e,r,n){let o=hSe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let h of d){let m=h.generationInfo?.completion??0;f[m]===void 0?f[m]=h:f[m]=f[m].concat(h)}return{generations:Object.entries(f).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=Dgt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=hSe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let h=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:h,total_tokens:h}}}let f=jgt(d,{usageMetadata:l,index:c});c+=1,f&&(yield f,await n?.handleLLMNewToken(f.text??""))}}async completionWithRetry(e,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(e)}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(kf(n)){let h=yZ(n);l=[{functionDeclarations:[{name:s,description:h.description??"A function available to call.",parameters:h}]}],u=new m3({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 m3({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=$i.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=$i.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return ai.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}};var _Z=class extends Ip{constructor(e){if(super(e??{}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"taskType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxBatchSize",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.modelName,this.model=this.modelName,this.taskType=e?.taskType??this.taskType,this.title=e?.title??this.title,this.title&&this.taskType!=="RETRIEVAL_DOCUMENT")throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");if(this.apiKey=e?.apiKey??Yt("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 WI(this.apiKey).getGenerativeModel({model:this.model})}_convertToContent(e){return{content:{role:"user",parts:[{text:this.stripNewLines?e.replace(/\n/g," "):e}]},taskType:this.taskType,title:this.title}}async _embedQueryContent(e){let r=this._convertToContent(e);return(await this.client.embedContent(r)).embedding.values??[]}async _embedDocumentsContent(e){let r=Dg(e,this.maxBatchSize),n=r.map(a=>({requests:a.map(s=>this._convertToContent(s))}));return(await Promise.allSettled(n.map(a=>this.client.batchEmbedContents(a)))).flatMap((a,s)=>a.status==="fulfilled"?a.value.embeddings.map(u=>u.values||[]):Array(r[s].length).fill([]))}embedQuery(e){return this.caller.call(this._embedQueryContent.bind(this),e)}embedDocuments(e){return this.caller.call(this._embedDocumentsContent.bind(this),e)}};var pc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},zd={searchParams:"URLSearchParams"in pc,iterable:"Symbol"in pc&&"iterator"in Symbol,blob:"FileReader"in pc&&"Blob"in pc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in pc,arrayBuffer:"ArrayBuffer"in pc};function YNr(t){return t&&DataView.prototype.isPrototypeOf(t)}zd.arrayBuffer&&(Lgt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],kgt=ArrayBuffer.isView||function(t){return t&&Lgt.indexOf(Object.prototype.toString.call(t))>-1});var Lgt,kgt;function nk(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function ySe(t){return typeof t!="string"&&(t=String(t)),t}function bSe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return zd.iterable&&(e[Symbol.iterator]=function(){return e}),e}function nl(t){this.map={},t instanceof nl?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}nl.prototype.append=function(t,e){t=nk(t),e=ySe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};nl.prototype.delete=function(t){delete this.map[nk(t)]};nl.prototype.get=function(t){return t=nk(t),this.has(t)?this.map[t]:null};nl.prototype.has=function(t){return this.map.hasOwnProperty(nk(t))};nl.prototype.set=function(t,e){this.map[nk(t)]=ySe(e)};nl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};nl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),bSe(t)};nl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),bSe(t)};nl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),bSe(t)};zd.iterable&&(nl.prototype[Symbol.iterator]=nl.prototype.entries);function gSe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function Bgt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function XNr(t){var e=new FileReader,r=Bgt(e);return e.readAsArrayBuffer(t),r}function ZNr(t){var e=new FileReader,r=Bgt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function QNr(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function Fgt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function $gt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:zd.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:zd.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:zd.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():zd.arrayBuffer&&zd.blob&&YNr(t)?(this._bodyArrayBuffer=Fgt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):zd.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||kgt(t))?this._bodyArrayBuffer=Fgt(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):zd.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},zd.blob&&(this.blob=function(){var t=gSe(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=gSe(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(zd.blob)return this.blob().then(XNr);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=gSe(this);if(t)return t;if(this._bodyBlob)return ZNr(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(QNr(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},zd.formData&&(this.formData=function(){return this.text().then(rLr)}),this.json=function(){return this.text().then(JSON.parse)},this}var eLr=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function tLr(t){var e=t.toUpperCase();return eLr.indexOf(e)>-1?e:t}function GI(t,e){if(!(this instanceof GI))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof GI){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new nl(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new nl(e.headers)),this.method=tLr(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in pc){var i=new AbortController;return i.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}GI.prototype.clone=function(){return new GI(this,{body:this._bodyInit})};function rLr(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(i))}}),e}function nLr(t){var e=new nl,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();try{e.append(i,a)}catch(s){console.warn("Response "+s.message)}}}),e}$gt.call(GI.prototype);function Jw(t,e){if(!(this instanceof Jw))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new nl(e.headers),this.url=e.url||"",this._initBody(t)}$gt.call(Jw.prototype);Jw.prototype.clone=function(){return new Jw(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new nl(this.headers),url:this.url})};Jw.error=function(){var t=new Jw(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var oLr=[301,302,303,307,308];Jw.redirect=function(t,e){if(oLr.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Jw(null,{status:e,headers:{location:t}})};var JI=pc.DOMException;try{new JI}catch{JI=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},JI.prototype=Object.create(Error.prototype),JI.prototype.constructor=JI}function qgt(t,e){return new Promise(function(r,n){var o=new GI(t,e);if(o.signal&&o.signal.aborted)return n(new JI("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:nLr(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 Jw(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 JI("Aborted","AbortError"))},0)};function s(l){try{return l===""&&pc.location.href?pc.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&&(zd.blob?i.responseType="blob":zd.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof nl||pc.Headers&&e.headers instanceof pc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(nk(l)),i.setRequestHeader(l,ySe(e.headers[l]))}),o.headers.forEach(function(l,c){u.indexOf(c)===-1&&i.setRequestHeader(c,l)})}else o.headers.forEach(function(l,c){i.setRequestHeader(c,l)});o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}qgt.polyfill=!0;pc.fetch||(pc.fetch=qgt,pc.Headers=nl,pc.Request=GI,pc.Response=Jw);var iLr="0.5.9",aLr=Object.defineProperty,sLr=(t,e,r)=>e in t?aLr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_Se=(t,e,r)=>(sLr(t,typeof e!="symbol"?e+"":e,r),r),g3=class extends Error{constructor(e,r){super(e),this.error=e,this.status_code=r,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,g3)}},wSe=class{constructor(e,r,n){_Se(this,"abortController"),_Se(this,"itr"),_Se(this,"doneCallback"),this.abortController=e,this.itr=r,this.doneCallback=n}abort(){this.abortController.abort()}async*[Symbol.asyncIterator](){for await(let e of this.itr){if("error"in e)throw new Error(e.error);if(yield e,e.done||e.status==="success"){this.doneCallback();return}}throw new Error("Did not receive done or success response in stream.")}},SSe=async t=>{if(t.ok)return;let e=`Error ${t.status}: ${t.statusText}`,r=null;if(t.headers.get("content-type")?.includes("application/json"))try{r=await t.json(),e=r.error||e}catch{console.log("Failed to parse error response as JSON")}else try{console.log("Getting text from response"),e=await t.text()||e}catch{console.log("Failed to get text from error response")}throw new g3(e,t.status)};function uLr(){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(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${iLr} (${uLr()})`};return r.headers||(r.headers={}),r.headers={...n,...r.headers},t(e,r)},Ugt=async(t,e)=>{let r=await xSe(t,e);return await SSe(r),r};var ok=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await xSe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await SSe(a),a},lLr=async(t,e,r)=>{let n=await xSe(t,e,{method:"DELETE",body:JSON.stringify(r)});return await SSe(n),n},cLr=async function*(t){let e=new TextDecoder("utf-8"),r="",n=t.getReader();for(;;){let{done:o,value:i}=await n.read();if(o)break;r+=e.decode(i);let a=r.split(`
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}for(let o of r.split(`
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},dLr=t=>{if(!t)return"http://127.0.0.1:11434";let e=t.includes("://");t.startsWith(":")&&(t=`http://127.0.0.1${t}`,e=!0),e||(t=`http://${t}`);let r=new URL(t),n=r.port;n||(e?n=r.protocol==="https:"?"443":"80":n="11434");let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},fLr=Object.defineProperty,pLr=(t,e,r)=>e in t?fLr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vSe=(t,e,r)=>(pLr(t,typeof e!="symbol"?e+"":e,r),r),KI=class{constructor(e){vSe(this,"config"),vSe(this,"fetch"),vSe(this,"ongoingStreamedRequests",[]),this.config={host:""},e?.proxy||(this.config.host=dLr(e?.host??"http://127.0.0.1:11434")),this.fetch=fetch,e?.fetch!=null&&(this.fetch=e.fetch)}abort(){for(let e of this.ongoingStreamedRequests)e.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(e,r){r.stream=r.stream??!1;let n=`${this.config.host}/api/${e}`;if(r.stream){let i=new AbortController,a=await ok(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=cLr(a.body),u=new wSe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await ok(this.fetch,n,r,{headers:this.config.headers})).json()}async encodeImage(e){if(typeof e!="string"){let r=new Uint8Array(e),n="",o=r.byteLength;for(let i=0;i<o;i++)n+=String.fromCharCode(r[i]);return btoa(n)}return e}async generate(e){return e.images&&(e.images=await Promise.all(e.images.map(this.encodeImage.bind(this)))),this.processStreamableRequest("generate",e)}async chat(e){if(e.messages)for(let r of e.messages)r.images&&(r.images=await Promise.all(r.images.map(this.encodeImage.bind(this))));return this.processStreamableRequest("chat",e)}async create(e){return this.processStreamableRequest("create",{name:e.model,stream:e.stream,modelfile:e.modelfile,quantize:e.quantize})}async pull(e){return this.processStreamableRequest("pull",{name:e.model,stream:e.stream,insecure:e.insecure})}async push(e){return this.processStreamableRequest("push",{name:e.model,stream:e.stream,insecure:e.insecure})}async delete(e){return await lLr(this.fetch,`${this.config.host}/api/delete`,{name:e.model}),{status:"success"}}async copy(e){return await ok(this.fetch,`${this.config.host}/api/copy`,{...e}),{status:"success"}}async list(){return await(await Ugt(this.fetch,`${this.config.host}/api/tags`)).json()}async show(e){return await(await ok(this.fetch,`${this.config.host}/api/show`,{...e})).json()}async embed(e){return await(await ok(this.fetch,`${this.config.host}/api/embed`,{...e})).json()}async embeddings(e){return await(await ok(this.fetch,`${this.config.host}/api/embeddings`,{...e})).json()}async ps(){return await(await Ugt(this.fetch,`${this.config.host}/api/ps`)).json()}},hLr=new KI;Vh();Ty();var hc=[];for(vZ=0;vZ<256;++vZ)hc.push((vZ+256).toString(16).slice(1));var vZ;function zgt(t,e=0){return(hc[t[e+0]]+hc[t[e+1]]+hc[t[e+2]]+hc[t[e+3]]+"-"+hc[t[e+4]]+hc[t[e+5]]+"-"+hc[t[e+6]]+hc[t[e+7]]+"-"+hc[t[e+8]]+hc[t[e+9]]+"-"+hc[t[e+10]]+hc[t[e+11]]+hc[t[e+12]]+hc[t[e+13]]+hc[t[e+14]]+hc[t[e+15]]).toLowerCase()}var wZ,mLr=new Uint8Array(16);function CSe(){if(!wZ&&(wZ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wZ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wZ(mLr)}var gLr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),OSe={randomUUID:gLr};function yLr(t,e,r){if(OSe.randomUUID&&!e&&!t)return OSe.randomUUID();t=t||{};var n=t.random||(t.rng||CSe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return zgt(n)}var ESe=yLr;function PSe(t,e){return new Dr({content:t.content??"",tool_call_chunks:t.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:ESe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function Hgt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function bLr(t){if(typeof t.content=="string")return[{role:"assistant",content:t.content}];let r=t.content.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>({role:"assistant",content:o.text})),n;if(t.content.find(o=>o.type==="tool_use")&&t.tool_calls?.length){let o=t.tool_calls?.map(i=>({id:i.id,type:"function",function:{name:i.name,arguments:i.args}}));o&&(n={role:"assistant",tool_calls:o,content:""})}else if(t.content.find(o=>o.type==="tool_use")&&!t.tool_calls?.length)throw new Error("'tool_use' content type is not supported without tool calls.");return[...r,...n?[n]:[]]}function _Lr(t){return typeof t.content=="string"?[{role:"user",content:t.content}]:t.content.map(e=>{if(e.type==="text")return{role:"user",content:e.text};if(e.type==="image_url"){if(typeof e.image_url=="string")return{role:"user",content:"",images:[Hgt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[Hgt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function vLr(t){if(typeof t.content=="string")return[{role:"system",content:t.content}];if(t.content.every(e=>e.type==="text"&&typeof e.text=="string"))return t.content.map(e=>({role:"system",content:e.text}));throw new Error(`Unsupported content type(s): ${t.content.map(e=>e.type).join(", ")}`)}function wLr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function Vgt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return _Lr(e);if(e._getType()==="ai")return bLr(e);if(e._getType()==="system")return vLr(e);if(e._getType()==="tool")return wLr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var SZ=class extends ba{static lc_name(){return"ChatOllama"}constructor(e){super(e??{}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"llama3"}),Object.defineProperty(this,"numa",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numBatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mainGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lowVram",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"f16Kv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitsAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vocabOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMmap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMlock",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"embeddingOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numThread",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numKeep",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numPredict",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tfsZ",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typicalP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatLastN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatTau",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatEta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"penalizeNewline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:"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 KI({host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.numa=e?.numa,this.numCtx=e?.numCtx,this.numBatch=e?.numBatch,this.numGpu=e?.numGpu,this.mainGpu=e?.mainGpu,this.lowVram=e?.lowVram,this.f16Kv=e?.f16Kv,this.logitsAll=e?.logitsAll,this.vocabOnly=e?.vocabOnly,this.useMmap=e?.useMmap,this.useMlock=e?.useMlock,this.embeddingOnly=e?.embeddingOnly,this.numThread=e?.numThread,this.numKeep=e?.numKeep,this.seed=e?.seed,this.numPredict=e?.numPredict,this.topK=e?.topK,this.topP=e?.topP,this.tfsZ=e?.tfsZ,this.typicalP=e?.typicalP,this.repeatLastN=e?.repeatLastN,this.temperature=e?.temperature,this.repeatPenalty=e?.repeatPenalty,this.presencePenalty=e?.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty,this.mirostat=e?.mirostat,this.mirostatTau=e?.mirostatTau,this.mirostatEta=e?.mirostatEta,this.penalizeNewline=e?.penalizeNewline,this.streaming=e?.streaming,this.format=e?.format,this.keepAlive=e?.keepAlive??this.keepAlive,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}_llmType(){return"ollama"}async pull(e,r){let{stream:n,insecure:o,logProgress:i}={stream:!0,...r};if(n)for await(let a of await this.client.pull({model:e,insecure:o,stream:n}))i&&console.log(a);else{let a=await this.client.pull({model:e,insecure:o});i&&console.log(a)}}bindTools(e,r){return this.bind({tools:e.map(n=>tk(n)),...r})}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"ollama",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.options?.temperature??void 0,ls_max_tokens:r.options?.num_predict??void 0,ls_stop:e.stop}}invocationParams(e){if(e?.tool_choice)throw new Error("Tool choice is not supported for ChatOllama.");return{model:this.model,format:this.format,keep_alive:this.keepAlive,options:{numa:this.numa,num_ctx:this.numCtx,num_batch:this.numBatch,num_gpu:this.numGpu,main_gpu:this.mainGpu,low_vram:this.lowVram,f16_kv:this.f16Kv,logits_all:this.logitsAll,vocab_only:this.vocabOnly,use_mmap:this.useMmap,use_mlock:this.useMlock,embedding_only:this.embeddingOnly,num_thread:this.numThread,num_keep:this.numKeep,seed:this.seed,num_predict:this.numPredict,top_k:this.topK,top_p:this.topP,tfs_z:this.tfsZ,typical_p:this.typicalP,repeat_last_n:this.repeatLastN,temperature:this.temperature,repeat_penalty:this.repeatPenalty,presence_penalty:this.presencePenalty,frequency_penalty:this.frequencyPenalty,mirostat:this.mirostat,mirostat_tau:this.mirostatTau,mirostat_eta:this.mirostatEta,penalize_newline:this.penalizeNewline,stop:e?.stop},tools:e?.tools?.length?e.tools.map(r=>tk(r)):void 0}}async checkModelExistsOnMachine(e){let{models:r}=await this.client.list();return!!r.find(n=>n.name===e||n.name===`${e}:latest`)}async _generate(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let a of this._streamResponseChunks(e,r,n))o?o=yl(o,a.message):o=a.message;let i=new To({id:o?.id,content:o?.content??"",tool_calls:o?.tool_calls,response_metadata:o?.response_metadata,usage_metadata:o?.usage_metadata});return{generations:[{text:typeof i.content=="string"?i.content:"",message:i}]}}async*_streamResponseChunks(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=Vgt(e),a={input_tokens:0,output_tokens:0,total_tokens:0};if(o.tools&&o.tools.length>0){let l=await this.client.chat({...o,messages:i,stream:!1}),{message:c,...d}=l;return a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,yield new Ho({text:c.content,message:PSe(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 Ho({text:c.content??"",message:PSe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new Ho({text:"",message:new Dr({content:"",response_metadata:u,usage_metadata:a})})}};var xZ=class extends Ip{constructor(e){super({maxConcurrency:1,...e}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mxbai-embed-large"}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://localhost:11434"}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:"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 KI({host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.keepAlive=e?.keepAlive??this.keepAlive,this.truncate=e?.truncate??this.truncate,this.requestOptions=e?.requestOptions?this._convertOptions(e?.requestOptions):void 0}_convertOptions(e){let r={},n={embeddingOnly:"embedding_only",frequencyPenalty:"frequency_penalty",keepAlive:"keep_alive",logitsAll:"logits_all",lowVram:"low_vram",mainGpu:"main_gpu",mirostat:"mirostat",mirostatEta:"mirostat_eta",mirostatTau:"mirostat_tau",numBatch:"num_batch",numCtx:"num_ctx",numGpu:"num_gpu",numKeep:"num_keep",numPredict:"num_predict",numThread:"num_thread",penalizeNewline:"penalize_newline",presencePenalty:"presence_penalty",repeatLastN:"repeat_last_n",repeatPenalty:"repeat_penalty",temperature:"temperature",stop:"stop",tfsZ:"tfs_z",topK:"top_k",topP:"top_p",typicalP:"typical_p",useMlock:"use_mlock",useMmap:"use_mmap",vocabOnly:"vocab_only",f16Kv:"f16_kv",numa:"numa",seed:"seed"};for(let[o,i]of Object.entries(e)){let a=n[o];a&&(r[a]=i)}return r}async embedDocuments(e){return this.embeddingWithRetry(e)}async embedQuery(e){return(await this.embeddingWithRetry([e]))[0]}async embeddingWithRetry(e){return(await this.caller.call(()=>this.client.embed({model:this.model,input:e,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}};Vh();var CZ="RFC3986",OZ={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},Wgt="RFC1738";var SLr=Array.isArray,Gw=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var TSe=1024,Jgt=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=TSe){let u=i.length>=TSe?i.slice(s,s+TSe):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===Wgt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=Gw[d];continue}if(d<2048){l[l.length]=Gw[192|d>>6]+Gw[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Gw[224|d>>12]+Gw[128|d>>6&63]+Gw[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=Gw[240|d>>18]+Gw[128|d>>12&63]+Gw[128|d>>6&63]+Gw[128|d&63]}a+=l.join("")}return a};function Ggt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function MSe(t,e){if(SLr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var xLr=Object.prototype.hasOwnProperty,Kgt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Kw=Array.isArray,CLr=Array.prototype.push,Ygt=function(t,e){CLr.apply(t,Kw(e)?e:[e])},OLr=Date.prototype.toISOString,ol={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Jgt,encodeValuesOnly:!1,format:CZ,formatter:OZ[CZ],indices:!1,serializeDate(t){return OLr.call(t)},skipNulls:!1,strictNullHandling:!1};function ELr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var ASe={};function Xgt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,v,g){let _=t,S=g,x=0,O=!1;for(;(S=S.get(ASe))!==void 0&&!O;){let N=S.get(t);if(x+=1,typeof N<"u"){if(N===x)throw new RangeError("Cyclic object value");O=!0}typeof S.get(ASe)>"u"&&(x=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&Kw(_)&&(_=MSe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!m?u(e,ol.encoder,v,"key",p):e;_=""}if(ELr(_)||Ggt(_)){if(u){let N=m?e:u(e,ol.encoder,v,"key",p);return[h?.(N)+"="+h?.(u(_,ol.encoder,v,"value",p))]}return[h?.(e)+"="+h?.(String(_))]}let T=[];if(typeof _>"u")return T;let E;if(r==="comma"&&Kw(_))m&&u&&(_=MSe(_,u)),E=[{value:_.length>0?_.join(",")||null:void 0}];else if(Kw(l))E=l;else{let N=Object.keys(_);E=c?N.sort(c):N}let M=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&Kw(_)&&_.length===1?M+"[]":M;if(o&&Kw(_)&&_.length===0)return R+"[]";for(let N=0;N<E.length;++N){let j=E[N],k=typeof j=="object"&&typeof j.value<"u"?j.value:_[j];if(a&&k===null)continue;let F=d&&s?j.replace(/\./g,"%2E"):j,L=Kw(_)?typeof r=="function"?r(R,F):R:R+(d?"."+F:"["+F+"]");g.set(t,x);let q=new WeakMap;q.set(ASe,g),Ygt(T,Xgt(k,L,r,n,o,i,a,s,r==="comma"&&m&&Kw(_)?null:u,l,c,d,f,p,h,m,v,q))}return T}function PLr(t=ol){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||ol.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=CZ;if(typeof t.format<"u"){if(!xLr.call(OZ,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=OZ[r],o=ol.filter;(typeof t.filter=="function"||Kw(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Kgt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=ol.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:ol.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ol.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ol.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ol.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ol.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ol.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ol.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ol.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ol.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ol.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ol.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ol.strictNullHandling}}function RSe(t,e={}){let r=t,n=PLr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Kw(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Kgt[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||Ygt(a,Xgt(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 YI="4.83.0";var Zgt=!1,XI,ISe,MLr,ALr,RLr,DSe,ILr,EZ,jSe,NSe,LSe,PZ,FSe;function Qgt(t,e={auto:!1}){if(Zgt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(XI)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${XI}'\``);Zgt=e.auto,XI=t.kind,ISe=t.fetch,MLr=t.Request,ALr=t.Response,RLr=t.Headers,DSe=t.FormData,ILr=t.Blob,EZ=t.File,jSe=t.ReadableStream,NSe=t.getMultipartRequestOptions,LSe=t.getDefaultAgent,PZ=t.fileFromPath,FSe=t.isFsReadStream}var TZ=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function eyt({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new TZ(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}}XI||Qgt(eyt(),{auto:!0});var zt=class extends Error{},_a=class extends zt{constructor(e,r,n,o){super(`${_a.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["x-request-id"],this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new lC({message:n,cause:MZ(r)});let i=r?.error;return e===400?new ik(e,i,n,o):e===401?new ak(e,i,n,o):e===403?new sk(e,i,n,o):e===404?new uk(e,i,n,o):e===409?new lk(e,i,n,o):e===422?new ck(e,i,n,o):e===429?new dk(e,i,n,o):e>=500?new fk(e,i,n,o):new _a(e,i,n,o)}},ls=class extends _a{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},lC=class extends _a{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},jg=class extends lC{constructor({message:e}={}){super({message:e??"Request timed out."})}},ik=class extends _a{},ak=class extends _a{},sk=class extends _a{},uk=class extends _a{},lk=class extends _a{},ck=class extends _a{},dk=class extends _a{},fk=class extends _a{},pk=class extends zt{constructor(){super("Could not parse response content as the length limit was reached")}},hk=class extends zt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var Yw=class{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=Yw.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(Yw.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new zt(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new zt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new zt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};Yw.NEWLINE_CHARS=new Set([`
`,"\r"]);Yw.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function kSe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Hd=class{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of NLr(e,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 _a(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 _a(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 Hd(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new Yw,s=kSe(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new Hd(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new Hd(()=>o(e),this.controller),new Hd(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new jSe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*NLr(t,e){if(!t.body)throw e.abort(),new zt("Attempted to iterate over a response with no body");let r=new BSe,n=new Yw,o=kSe(t.body);for await(let i of LLr(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*LLr(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=FLr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function FLr(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var BSe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=kLr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function kLr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var tyt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",ryt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&y3(t),y3=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",BLr=t=>ryt(t)||tyt(t)||FSe(t);async function USe(t,e,r){if(t=await t,ryt(t))return t;if(tyt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=y3(o)?[await o.arrayBuffer()]:[o];return new EZ(i,e,r)}let n=await $Lr(t);if(e||(e=ULr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new EZ(n,e,r)}async function $Lr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(y3(t))e.push(await t.arrayBuffer());else if(zLr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${qLr(t)}`);return e}function qLr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function ULr(t){return $Se(t.name)||$Se(t.filename)||$Se(t.path)?.split(/[\\/]/).pop()}var $Se=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},zLr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",zSe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var Wh=async t=>{let e=await nyt(t.body);return NSe(e,t)},nyt=async t=>{let e=new DSe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>qSe(e,r,n))),e};var qSe=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(BLr(r)){let n=await USe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>qSe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>qSe(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var VLr=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},WLr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},AZ;async function lyt(t){let{response:e}=t;if(t.options.stream)return mk("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Hd.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return mk("response",e.status,e.url,e.headers,i),cyt(i,e)}let o=await e.text();return mk("response",e.status,e.url,e.headers,o),o}function cyt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var gk=class extends Promise{constructor(e,r=lyt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new gk(this.responsePromise,async r=>cyt(e(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},IZ=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=HSe("maxRetries",r),this.timeout=HSe("timeout",n),this.httpAgent=o,this.fetch=i??ISe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...XLr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${tFr()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&y3(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:r=0}={}){e={...e};let{method:n,path:o,query:i,headers:a={}}=e,s=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:zSe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,u=this.calculateContentLength(s),l=this.buildURL(o,i);"timeout"in e&&HSe("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??LSe(l),d=e.timeout+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:a,contentLength:u,retryCount:r});return{req:{method:n,...s&&{body:s},headers:f,...c&&{agent:c},signal:e.signal??null},url:l,timeout:e.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return syt(i,a),syt(i,r),zSe(e.body)&&XI!=="node"&&delete i["content-type"],RZ(a,"x-stainless-retry-count")===void 0&&RZ(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),RZ(a,"x-stainless-timeout")===void 0&&RZ(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),this.validateHeaders(i,r),i}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return _a.generate(e,r,n,o)}request(e,r=null){return new gk(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e,o=n.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(n);let{req:i,url:a,timeout:s}=this.buildRequest(n,{retryCount:o-r});if(await this.prepareRequest(i,{url:a,options:n}),mk("request",a,n,i.headers),n.signal?.aborted)throw new ls;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(MZ);if(l instanceof Error){if(n.signal?.aborted)throw new ls;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new jg:new lC({cause:l})}let c=JLr(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let v=`retrying, ${r} attempts remaining`;return mk(`response (error; ${v})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(v=>MZ(v).message),f=ZLr(d),p=f?void 0:d;throw mk(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,l.status,a,c,p),this.makeStatusError(l.status,f,p,c)}return{response:l,options:n,controller:u}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new VSe(this,n,e)}buildURL(e,r){let n=eFr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return dyt(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new zt(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n),u={signal:o.signal,...a};return u.method&&(u.method=u.method.toUpperCase()),this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s)})}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await cC(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${YI}`}},b3=class{constructor(e,r,n,o){AZ.set(this,void 0),VLr(this,AZ,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new zt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await WLr(this,AZ,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(AZ=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},VSe=class extends gk{constructor(e,r,n){super(r,async o=>new n(e,o.response,await lyt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},JLr=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),GLr={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},ci=t=>typeof t=="object"&&t!==null&&!dyt(t)&&Object.keys(t).every(e=>fyt(GLr,e)),KLr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":YI,"X-Stainless-OS":iyt(Deno.build.os),"X-Stainless-Arch":oyt(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":YI,"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":YI,"X-Stainless-OS":iyt(process.platform),"X-Stainless-Arch":oyt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=YLr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":YI,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":YI,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function YLr(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var oyt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",iyt=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),ayt,XLr=()=>ayt??(ayt=KLr()),ZLr=t=>{try{return JSON.parse(t)}catch{return}},QLr=/^[a-z][a-z0-9+.-]*:/i,eFr=t=>QLr.test(t),cC=t=>new Promise(e=>setTimeout(e,t)),HSe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new zt(`${t} must be an integer`);if(e<0)throw new zt(`${t} must be a positive integer`);return e},MZ=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(t)};var _3=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function dyt(t){if(!t)return!0;for(let e in t)return!1;return!0}function fyt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function syt(t,e){for(let r in e){if(!fyt(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}var uyt=new Set(["authorization","api-key"]);function mk(t,...e){if(typeof process<"u"&&process?.env?.DEBUG==="true"){let r=e.map(n=>{if(!n)return n;if(n.headers){let i={...n,headers:{...n.headers}};for(let a in n.headers)uyt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)uyt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}var tFr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),pyt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",rFr=t=>typeof t?.get=="function";var RZ=(t,e)=>{let r=e.toLowerCase();if(rFr(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o};function v3(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var DZ=class extends b3{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}},va=class extends b3{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[]}getPaginatedItems(){return this.data??[]}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){let e=this.getPaginatedItems();if(!e.length)return null;let r=e[e.length-1]?.id;return r?{params:{after:r}}:null}};var ct=class{constructor(e){this._client=e}};var yk=class extends ct{create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}};var XP=class extends ct{constructor(){super(...arguments),this.completions=new yk(this._client)}};XP.Completions=yk;var bk=class extends ct{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}};var _k=class extends ct{create(e,r){return this._client.post("/audio/transcriptions",Wh({body:e,...r,__metadata:{model:e.model}}))}};var vk=class extends ct{create(e,r){return this._client.post("/audio/translations",Wh({body:e,...r,__metadata:{model:e.model}}))}};var Xw=class extends ct{constructor(){super(...arguments),this.transcriptions=new _k(this._client),this.translations=new vk(this._client),this.speech=new bk(this._client)}};Xw.Transcriptions=_k;Xw.Translations=vk;Xw.Speech=bk;var ZP=class extends ct{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/batches/${e}`,r)}list(e={},r){return ci(e)?this.list({},e):this._client.getAPIList("/batches",QI,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},QI=class extends va{};ZP.BatchesPage=QI;var e1=class extends ct{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/assistants/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return ci(e)?this.list({},e):this._client.getAPIList("/assistants",wk,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},wk=class extends va{};e1.AssistantsPage=wk;function WSe(t){return typeof t.parse=="function"}var QP=t=>t?.role==="assistant",JSe=t=>t?.role==="function",GSe=t=>t?.role==="tool";var Ng=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},wa=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},KSe,jZ,NZ,w3,S3,LZ,x3,dC,C3,FZ,kZ,Sk,hyt,xk=class{constructor(){KSe.add(this),this.controller=new AbortController,jZ.set(this,void 0),NZ.set(this,()=>{}),w3.set(this,()=>{}),S3.set(this,void 0),LZ.set(this,()=>{}),x3.set(this,()=>{}),dC.set(this,{}),C3.set(this,!1),FZ.set(this,!1),kZ.set(this,!1),Sk.set(this,!1),Ng(this,jZ,new Promise((e,r)=>{Ng(this,NZ,e,"f"),Ng(this,w3,r,"f")}),"f"),Ng(this,S3,new Promise((e,r)=>{Ng(this,LZ,e,"f"),Ng(this,x3,r,"f")}),"f"),wa(this,jZ,"f").catch(()=>{}),wa(this,S3,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},wa(this,KSe,"m",hyt).bind(this))},0)}_connected(){this.ended||(wa(this,NZ,"f").call(this),this._emit("connect"))}get ended(){return wa(this,C3,"f")}get errored(){return wa(this,FZ,"f")}get aborted(){return wa(this,kZ,"f")}abort(){this.controller.abort()}on(e,r){return(wa(this,dC,"f")[e]||(wa(this,dC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=wa(this,dC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(wa(this,dC,"f")[e]||(wa(this,dC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Ng(this,Sk,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Ng(this,Sk,!0,"f"),await wa(this,S3,"f")}_emit(e,...r){if(wa(this,C3,"f"))return;e==="end"&&(Ng(this,C3,!0,"f"),wa(this,LZ,"f").call(this));let n=wa(this,dC,"f")[e];if(n&&(wa(this,dC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!wa(this,Sk,"f")&&!n?.length&&Promise.reject(o),wa(this,w3,"f").call(this,o),wa(this,x3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!wa(this,Sk,"f")&&!n?.length&&Promise.reject(o),wa(this,w3,"f").call(this,o),wa(this,x3,"f").call(this,o),this._emit("end")}}_emitFinal(){}};jZ=new WeakMap,NZ=new WeakMap,w3=new WeakMap,S3=new WeakMap,LZ=new WeakMap,x3=new WeakMap,dC=new WeakMap,C3=new WeakMap,FZ=new WeakMap,kZ=new WeakMap,Sk=new WeakMap,KSe=new WeakSet,hyt=function(e){if(Ng(this,FZ,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ls),e instanceof ls)return Ng(this,kZ,!0,"f"),this._emit("abort",e);if(e instanceof zt)return this._emit("error",e);if(e instanceof Error){let r=new zt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new zt(String(e)))};function myt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function YSe(t){return t?.$brand==="auto-parseable-response-format"}function gyt(t,{parser:e,callback:r}){let n={...t};return Object.defineProperties(n,{$brand:{value:"auto-parseable-tool",enumerable:!1},$parseRaw:{value:e,enumerable:!1},$callback:{value:r,enumerable:!1}}),n}function t1(t){return t?.$brand==="auto-parseable-tool"}function yyt(t,e){return!e||!XSe(e)?{...t,choices:t.choices.map(r=>({...r,message:{...r.message,parsed:null,tool_calls:r.message.tool_calls??[]}}))}:O3(t,e)}function O3(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new pk;if(n.finish_reason==="content_filter")throw new hk;return{...n,message:{...n.message,tool_calls:n.message.tool_calls?.map(o=>lFr(e,o))??[],parsed:n.message.content&&!n.message.refusal?uFr(e,n.message.content):null}}});return{...t,choices:r}}function uFr(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function lFr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:t1(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function byt(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return t1(r)||r?.function.strict||!1}function XSe(t){return YSe(t.response_format)?!0:t.tools?.some(e=>t1(e)||e.type==="function"&&e.function.strict===!0)??!1}function _yt(t){for(let e of t??[]){if(e.type!=="function")throw new zt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new zt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Bf=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ud,ZSe,BZ,QSe,exe,txe,wyt,rxe,vyt=10,Ck=class extends xk{constructor(){super(...arguments),ud.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),(JSe(e)||GSe(e))&&e.content)this._emit("functionCallResult",e.content);else if(QP(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(QP(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new zt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Bf(this,ud,"m",ZSe).call(this)}async finalMessage(){return await this.done(),Bf(this,ud,"m",BZ).call(this)}async finalFunctionCall(){return await this.done(),Bf(this,ud,"m",QSe).call(this)}async finalFunctionCallResult(){return await this.done(),Bf(this,ud,"m",exe).call(this)}async totalUsage(){return await this.done(),Bf(this,ud,"m",txe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Bf(this,ud,"m",BZ).call(this);r&&this._emit("finalMessage",r);let n=Bf(this,ud,"m",ZSe).call(this);n&&this._emit("finalContent",n);let o=Bf(this,ud,"m",QSe).call(this);o&&this._emit("finalFunctionCall",o);let i=Bf(this,ud,"m",exe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Bf(this,ud,"m",txe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Bf(this,ud,"m",wyt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(O3(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runFunctions(e,r,n){let o="function",{function_call:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.name,{maxChatCompletions:l=vyt}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let h=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new zt("missing message in ChatCompletion response");if(!h.function_call)return;let{name:m,arguments:v}=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 _;try{_=WSe(g)?await g.parse(v):v}catch(O){this._addMessage({role:o,name:m,content:O instanceof Error?O.message:String(O)});continue}let S=await g.function(_,this),x=Bf(this,ud,"m",rxe).call(this,S);if(this._addMessage({role:o,name:m,content:x}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=vyt}=n||{},c=r.tools.map(p=>{if(t1(p)){if(!p.$callback)throw new zt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let m=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new zt("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let v of m.tool_calls){if(v.type!=="function")continue;let g=v.id,{name:_,arguments:S}=v.function,x=d[_];if(x){if(u&&u!==_){let M=`Invalid tool_call: ${JSON.stringify(_)}. ${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(_)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}let O;try{O=WSe(x)?await x.parse(S):S}catch(M){let R=M instanceof Error?M.message:String(M);this._addMessage({role:o,tool_call_id:g,content:R});continue}let T=await x.function(O,this),E=Bf(this,ud,"m",rxe).call(this,T);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};ud=new WeakSet,ZSe=function(){return Bf(this,ud,"m",BZ).call(this).content??null},BZ=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(QP(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 zt("stream ended without producing a ChatCompletionMessage with role=assistant")},QSe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(QP(r)&&r?.function_call)return r.function_call;if(QP(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},exe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(JSe(r)&&r.content!=null||GSe(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}},txe=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},wyt=function(e){if(e.n!=null&&e.n>1)throw new zt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},rxe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var eT=class extends Ck{static runFunctions(e,r,n){let o=new eT,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new eT,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),QP(e)&&e.content&&this._emit("content",e.content)}};var Rl={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},nxe=class extends Error{},oxe=class extends Error{};function cFr(t,e=Rl.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return dFr(t.trim(),e)}var dFr=(t,e)=>{let r=t.length,n=0,o=f=>{throw new nxe(`${f} at position ${n}`)},i=f=>{throw new oxe(`${f} at position ${n}`)},a=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?s():t[n]==="{"?u():t[n]==="["?l():t.substring(n,n+4)==="null"||Rl.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Rl.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Rl.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Rl.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Rl.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Rl.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(h){i(String(h))}else if(Rl.STR&e)try{return JSON.parse(t.substring(f,n-Number(p))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},u=()=>{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Rl.OBJ&e)return f;let p=s();d(),n++;try{let h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(Rl.OBJ&e)return f;throw h}d(),t[n]===","&&n++}}catch{if(Rl.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(a()),d(),t[n]===","&&n++}catch{if(Rl.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Rl.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Rl.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Rl.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Rl.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},ixe=t=>cFr(t,Rl.ALL^Rl.NUM);var Ok=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Jo=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},il,fC,Ek,tT,axe,$Z,sxe,uxe,lxe,qZ,cxe,Syt,pC=class extends Ck{constructor(e){super(),il.add(this),fC.set(this,void 0),Ek.set(this,void 0),tT.set(this,void 0),Ok(this,fC,e,"f"),Ok(this,Ek,[],"f")}get currentChatCompletionSnapshot(){return Jo(this,tT,"f")}static fromReadableStream(e){let r=new pC(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new pC(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Jo(this,il,"m",axe).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)Jo(this,il,"m",sxe).call(this,a);if(i.controller.signal?.aborted)throw new ls;return this._addChatCompletion(Jo(this,il,"m",qZ).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Jo(this,il,"m",axe).call(this),this._connected();let o=Hd.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Jo(this,il,"m",qZ).call(this)),Jo(this,il,"m",sxe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new ls;return this._addChatCompletion(Jo(this,il,"m",qZ).call(this))}[(fC=new WeakMap,Ek=new WeakMap,tT=new WeakMap,il=new WeakSet,axe=function(){this.ended||Ok(this,tT,void 0,"f")},$Z=function(r){let n=Jo(this,Ek,"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,Ek,"f")[r.index]=n,n)},sxe=function(r){if(this.ended)return;let n=Jo(this,il,"m",Syt).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,il,"m",$Z).call(this,i);i.finish_reason&&(Jo(this,il,"m",lxe).call(this,i),a.current_tool_call_index!=null&&Jo(this,il,"m",uxe).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,il,"m",lxe).call(this,i),a.current_tool_call_index!=null&&Jo(this,il,"m",uxe).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))}}},uxe=function(r,n){if(Jo(this,il,"m",$Z).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,fC,"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:t1(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},lxe=function(r){let n=Jo(this,il,"m",$Z).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Jo(this,il,"m",cxe).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}))},qZ=function(){if(this.ended)throw new zt("stream has ended, this shouldn't happen");let r=Jo(this,tT,"f");if(!r)throw new zt("request ended without sending any chunks");return Ok(this,tT,void 0,"f"),Ok(this,Ek,[],"f"),fFr(r,Jo(this,fC,"f"))},cxe=function(){let r=Jo(this,fC,"f")?.response_format;return YSe(r)?r:null},Syt=function(r){var n,o,i,a;let s=Jo(this,tT,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Ok(this,tT,{...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,fC,"f")&&XSe(Jo(this,fC,"f")))){if(d==="length")throw new pk;if(d==="content_filter")throw new hk}if(Object.assign(m,h),!c)continue;let{content:v,refusal:g,function_call:_,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),_&&(m.message.function_call?(_.name&&(m.message.function_call.name=_.name),_.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=_.arguments)):m.message.function_call=_),v&&(m.message.content=(m.message.content||"")+v,!m.message.refusal&&Jo(this,il,"m",cxe).call(this)&&(m.message.parsed=ixe(m.message.content))),x){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:T,id:E,type:M,function:R,...N}of x){let j=(a=m.message.tool_calls)[T]??(a[T]={});Object.assign(j,N),E&&(j.id=E),M&&(j.type=M),R&&(j.function??(j.function={name:R.name??"",arguments:""})),R?.name&&(j.function.name=R.name),R?.arguments&&(j.function.arguments+=R.arguments,byt(Jo(this,fC,"f"),j)&&(j.function.parsed_arguments=ixe(j.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Hd(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function fFr(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new zt(`missing finish_reason for choice ${d}`);let{content:h=null,function_call:m,tool_calls:v,...g}=l,_=l.role;if(!_)throw new zt(`missing role for choice ${d}`);if(m){let{arguments:S,name:x}=m;if(S==null)throw new zt(`missing function_call.arguments for choice ${d}`);if(!x)throw new zt(`missing function_call.name for choice ${d}`);return{...p,message:{content:h,function_call:{arguments:S,name:x},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return v?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:_,content:h,refusal:l.refusal??null,tool_calls:v.map((S,x)=>{let{function:O,type:T,id:E,...M}=S,{arguments:R,name:N,...j}=O||{};if(E==null)throw new zt(`missing choices[${d}].tool_calls[${x}].id
${UZ(t)}`);if(T==null)throw new zt(`missing choices[${d}].tool_calls[${x}].type
${UZ(t)}`);if(N==null)throw new zt(`missing choices[${d}].tool_calls[${x}].function.name
${UZ(t)}`);if(R==null)throw new zt(`missing choices[${d}].tool_calls[${x}].function.arguments
${UZ(t)}`);return{...M,id:E,type:T,function:{...j,name:N,arguments:R}}})}}:{...p,message:{...g,content:h,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return yyt(u,e)}function UZ(t){return JSON.stringify(t)}var hC=class extends pC{static fromReadableStream(e){let r=new hC(null);return r._run(()=>r._fromReadableStream(e)),r}static runFunctions(e,r,n){let o=new hC(null),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new hC(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var E3=class extends ct{parse(e,r){return _yt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>O3(n,e))}runFunctions(e,r){return e.stream?hC.runFunctions(this._client,e,r):eT.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?hC.runTools(this._client,e,r):eT.runTools(this._client,e,r)}stream(e,r){return pC.createChatCompletion(this._client,e,r)}};var Pk=class extends ct{constructor(){super(...arguments),this.completions=new E3(this._client)}};(function(t){t.Completions=E3})(Pk||(Pk={}));var Tk=class extends ct{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var r1=class extends ct{constructor(){super(...arguments),this.sessions=new Tk(this._client)}};r1.Sessions=Tk;var Ct=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Dp=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},mc,dxe,Zw,zZ,Lg,o1,Mk,n1,WZ,jp,HZ,VZ,M3,P3,T3,xyt,Cyt,Oyt,Eyt,Pyt,Tyt,Myt,Vd=class extends xk{constructor(){super(...arguments),mc.add(this),dxe.set(this,[]),Zw.set(this,{}),zZ.set(this,{}),Lg.set(this,void 0),o1.set(this,void 0),Mk.set(this,void 0),n1.set(this,void 0),WZ.set(this,void 0),jp.set(this,void 0),HZ.set(this,void 0),VZ.set(this,void 0),M3.set(this,void 0)}[(dxe=new WeakMap,Zw=new WeakMap,zZ=new WeakMap,Lg=new WeakMap,o1=new WeakMap,Mk=new WeakMap,n1=new WeakMap,WZ=new WeakMap,jp=new WeakMap,HZ=new WeakMap,VZ=new WeakMap,M3=new WeakMap,mc=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Vd;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=Hd.fromReadableStream(e,this.controller);for await(let i of o)Ct(this,mc,"m",P3).call(this,i);if(o.controller.signal?.aborted)throw new ls;return this._addRun(Ct(this,mc,"m",T3).call(this))}toReadableStream(){return new Hd(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o,i){let a=new Vd;return a._run(()=>a._runToolAssistantStream(e,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,r,n,o,i){let a=i?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));let s={...o,stream:!0},u=await e.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)Ct(this,mc,"m",P3).call(this,l);if(u.controller.signal?.aborted)throw new ls;return this._addRun(Ct(this,mc,"m",T3).call(this))}static createThreadAssistantStream(e,r,n){let o=new Vd;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new Vd;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Ct(this,HZ,"f")}currentRun(){return Ct(this,VZ,"f")}currentMessageSnapshot(){return Ct(this,Lg,"f")}currentRunStepSnapshot(){return Ct(this,M3,"f")}async finalRunSteps(){return await this.done(),Object.values(Ct(this,Zw,"f"))}async finalMessages(){return await this.done(),Object.values(Ct(this,zZ,"f"))}async finalRun(){if(await this.done(),!Ct(this,o1,"f"))throw Error("Final run was not received.");return Ct(this,o1,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)Ct(this,mc,"m",P3).call(this,s);if(a.controller.signal?.aborted)throw new ls;return this._addRun(Ct(this,mc,"m",T3).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)Ct(this,mc,"m",P3).call(this,u);if(s.controller.signal?.aborted)throw new ls;return this._addRun(Ct(this,mc,"m",T3).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(v3(i)&&v3(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(!v3(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o,i){return await this._createToolAssistantStream(n,e,r,o,i)}};P3=function(e){if(!this.ended)switch(Dp(this,HZ,e,"f"),Ct(this,mc,"m",Oyt).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":Ct(this,mc,"m",Myt).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Ct(this,mc,"m",Cyt).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":Ct(this,mc,"m",xyt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier")}},T3=function(){if(this.ended)throw new zt("stream has ended, this shouldn't happen");if(!Ct(this,o1,"f"))throw Error("Final run has not been received");return Ct(this,o1,"f")},xyt=function(e){let[r,n]=Ct(this,mc,"m",Pyt).call(this,e,Ct(this,Lg,"f"));Dp(this,Lg,r,"f"),Ct(this,zZ,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,a=r.content[o.index];if(a&&a.type=="text")this._emit("textDelta",i,a.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=Ct(this,Mk,"f")){if(Ct(this,n1,"f"))switch(Ct(this,n1,"f").type){case"text":this._emit("textDone",Ct(this,n1,"f").text,Ct(this,Lg,"f"));break;case"image_file":this._emit("imageFileDone",Ct(this,n1,"f").image_file,Ct(this,Lg,"f"));break}Dp(this,Mk,o.index,"f")}Dp(this,n1,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Ct(this,Mk,"f")!==void 0){let o=e.data.content[Ct(this,Mk,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Ct(this,Lg,"f"));break;case"text":this._emit("textDone",o.text,Ct(this,Lg,"f"));break}}Ct(this,Lg,"f")&&this._emit("messageDone",e.data),Dp(this,Lg,void 0,"f")}},Cyt=function(e){let r=Ct(this,mc,"m",Eyt).call(this,e);switch(Dp(this,M3,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==Ct(this,WZ,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Ct(this,jp,"f")&&this._emit("toolCallDone",Ct(this,jp,"f")),Dp(this,WZ,i.index,"f"),Dp(this,jp,r.step_details.tool_calls[i.index],"f"),Ct(this,jp,"f")&&this._emit("toolCallCreated",Ct(this,jp,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Dp(this,M3,void 0,"f"),e.data.step_details.type=="tool_calls"&&Ct(this,jp,"f")&&(this._emit("toolCallDone",Ct(this,jp,"f")),Dp(this,jp,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},Oyt=function(e){Ct(this,dxe,"f").push(e),this._emit("event",e)},Eyt=function(e){switch(e.event){case"thread.run.step.created":return Ct(this,Zw,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Ct(this,Zw,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Vd.accumulateDelta(r,n.delta);Ct(this,Zw,"f")[e.data.id]=o}return Ct(this,Zw,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":Ct(this,Zw,"f")[e.data.id]=e.data;break}if(Ct(this,Zw,"f")[e.data.id])return Ct(this,Zw,"f")[e.data.id];throw new Error("No snapshot available")},Pyt=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let a=r.content[i.index];r.content[i.index]=Ct(this,mc,"m",Tyt).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")},Tyt=function(e,r){return Vd.accumulateDelta(r,e)},Myt=function(e){switch(Dp(this,VZ,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":Dp(this,o1,e.data,"f"),Ct(this,jp,"f")&&(this._emit("toolCallDone",Ct(this,jp,"f")),Dp(this,jp,void 0,"f"));break;case"thread.run.cancelling":break}};var i1=class extends ct{create(e,r,n){return this._client.post(`/threads/${e}/messages`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/messages/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return ci(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,Ak,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},Ak=class extends va{};i1.MessagesPage=Ak;var a1=class extends ct{retrieve(e,r,n,o={},i){return ci(o)?this.retrieve(e,r,n,{},o):this._client.get(`/threads/${e}/runs/${r}/steps/${n}`,{query:o,...i,headers:{"OpenAI-Beta":"assistants=v2",...i?.headers}})}list(e,r,n={},o){return ci(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,Rk,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},Rk=class extends va{};a1.RunStepsPage=Rk;var mC=class extends ct{constructor(){super(...arguments),this.steps=new a1(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers},stream:r.stream??!1})}retrieve(e,r,n){return this._client.get(`/threads/${e}/runs/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return ci(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,Ik,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/threads/${e}/runs/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}createAndStream(e,r,n){return Vd.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await cC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return Vd.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}/submit_tool_outputs`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers},stream:n.stream??!1})}async submitToolOutputsAndPoll(e,r,n,o){let i=await this.submitToolOutputs(e,r,n,o);return await this.poll(e,i.id,o)}submitToolOutputsStream(e,r,n,o){return Vd.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},Ik=class extends va{};mC.RunsPage=Ik;mC.Steps=a1;mC.RunStepsPage=Rk;var Qw=class extends ct{constructor(){super(...arguments),this.runs=new mC(this._client),this.messages=new i1(this._client)}create(e={},r){return ci(e)?this.create({},e):this._client.post("/threads",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/threads/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r){return this._client.delete(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers},stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.thread_id,n.id,r)}createAndRunStream(e,r){return Vd.createThreadAssistantStream(e,this._client.beta.threads,r)}};Qw.Runs=mC;Qw.RunsPage=Ik;Qw.Messages=i1;Qw.MessagesPage=Ak;var Ayt=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var s1=class extends ct{create(e,r,n){return this._client.post(`/vector_stores/${e}/files`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e,r={},n){return ci(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,rT,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let i=await this.retrieve(e,r,{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await cC(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}},rT=class extends va{};s1.VectorStoreFilesPage=rT;var Dk=class extends ct{create(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/file_batches/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n={},o){return ci(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,rT,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await cC(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await Ayt(d),await this.createAndPoll(e,{file_ids:l})}};var eS=class extends ct{constructor(){super(...arguments),this.files=new s1(this._client),this.fileBatches=new Dk(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/vector_stores/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return ci(e)?this.list({},e):this._client.getAPIList("/vector_stores",jk,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},jk=class extends va{};eS.VectorStoresPage=jk;eS.Files=s1;eS.VectorStoreFilesPage=rT;eS.FileBatches=Dk;var Np=class extends ct{constructor(){super(...arguments),this.realtime=new r1(this._client),this.vectorStores=new eS(this._client),this.chat=new Pk(this._client),this.assistants=new e1(this._client),this.threads=new Qw(this._client)}};Np.Realtime=r1;Np.VectorStores=eS;Np.VectorStoresPage=jk;Np.Assistants=e1;Np.AssistantsPage=wk;Np.Threads=Qw;var u1=class extends ct{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var l1=class extends ct{create(e,r){return this._client.post("/embeddings",{body:e,...r})}};var nT=class extends ct{create(e,r){return this._client.post("/files",Wh({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return ci(e)?this.list({},e):this._client.getAPIList("/files",c1,{query:e,...r})}del(e,r){return this._client.delete(`/files/${e}`,r)}content(e,r){return this._client.get(`/files/${e}/content`,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})}retrieveContent(e,r){return this._client.get(`/files/${e}/content`,r)}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await cC(r),a=await this.retrieve(e),Date.now()-i>n)throw new jg({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},c1=class extends va{};nT.FileObjectsPage=c1;var d1=class extends ct{list(e,r={},n){return ci(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,Nk,{query:r,...n})}},Nk=class extends va{};d1.FineTuningJobCheckpointsPage=Nk;var tS=class extends ct{constructor(){super(...arguments),this.checkpoints=new d1(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(`/fine_tuning/jobs/${e}`,r)}list(e={},r){return ci(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",Lk,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return ci(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,Fk,{query:r,...n})}},Lk=class extends va{},Fk=class extends va{};tS.FineTuningJobsPage=Lk;tS.FineTuningJobEventsPage=Fk;tS.Checkpoints=d1;tS.FineTuningJobCheckpointsPage=Nk;var rS=class extends ct{constructor(){super(...arguments),this.jobs=new tS(this._client)}};rS.Jobs=tS;rS.FineTuningJobsPage=Lk;rS.FineTuningJobEventsPage=Fk;var f1=class extends ct{createVariation(e,r){return this._client.post("/images/variations",Wh({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",Wh({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}};var oT=class extends ct{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",p1,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},p1=class extends DZ{};oT.ModelsPage=p1;var h1=class extends ct{create(e,r){return this._client.post("/moderations",{body:e,...r})}};var kk=class extends ct{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,Wh({body:r,...n}))}};var iT=class extends ct{constructor(){super(...arguments),this.parts=new kk(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(`/uploads/${e}/complete`,{body:r,...n})}};iT.Parts=kk;var Ryt,Ar=class extends IZ{constructor({baseURL:e=_3("OPENAI_BASE_URL"),apiKey:r=_3("OPENAI_API_KEY"),organization:n=_3("OPENAI_ORG_ID")??null,project:o=_3("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new zt("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let a={apiKey:r,organization:n,project:o,...i,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&pyt())throw new zt(`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 u1(this),this.chat=new XP(this),this.embeddings=new l1(this),this.files=new nT(this),this.images=new f1(this),this.audio=new Xw(this),this.moderations=new h1(this),this.models=new oT(this),this.fineTuning=new rS(this),this.beta=new Np(this),this.batches=new ZP(this),this.uploads=new iT(this),this._options=a,this.apiKey=r,this.organization=n,this.project=o}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(e){return RSe(e,{arrayFormat:"brackets"})}};Ryt=Ar;Ar.OpenAI=Ryt;Ar.DEFAULT_TIMEOUT=6e5;Ar.OpenAIError=zt;Ar.APIError=_a;Ar.APIConnectionError=lC;Ar.APIConnectionTimeoutError=jg;Ar.APIUserAbortError=ls;Ar.NotFoundError=uk;Ar.ConflictError=lk;Ar.RateLimitError=dk;Ar.BadRequestError=ik;Ar.AuthenticationError=ak;Ar.InternalServerError=fk;Ar.PermissionDeniedError=sk;Ar.UnprocessableEntityError=ck;Ar.toFile=USe;Ar.fileFromPath=PZ;Ar.Completions=u1;Ar.Chat=XP;Ar.Embeddings=l1;Ar.Files=nT;Ar.FileObjectsPage=c1;Ar.Images=f1;Ar.Audio=Xw;Ar.Moderations=h1;Ar.Models=oT;Ar.ModelsPage=p1;Ar.FineTuning=rS;Ar.Beta=Np;Ar.Batches=ZP;Ar.BatchesPage=QI;Ar.Uploads=iT;Vh();uC();sx();iE();Dj();Kue();oE();bA();function m1(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=Ej(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new cp([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(`
`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function Bk(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function $k(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var fxe=class extends PA{static lc_name(){return"JsonOutputToolsParser"}constructor(e){super(e),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,r=!0){let n=e[0].message,o;if(Gu(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=>m1(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}},Fg=class extends fxe{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new cp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}};hh();var Dyt=Symbol("Let zodToJsonSchema decide on which parser to use"),Iyt={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"},jyt=t=>typeof t=="string"?{...Iyt,basePath:["#"],definitions:{},name:t}:{...Iyt,basePath:["#"],definitions:{},...t};var A3=t=>"_def"in t?t._def:t;function Nyt(t){if(!t)return!0;for(let e in t)return!1;return!0}var Lyt=t=>{let e=jyt(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[A3(o),{def:A3(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function pxe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function vn(t,e,r,n,o){t[e]=r,pxe(t,e,n,o)}Pd();function Fyt(){return{}}Pd();function kyt(t,e){let r={type:"array"};return t.type?._def?.typeName!==ne.ZodAny&&(r.items=Bt(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&vn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&vn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(vn(r,"minItems",t.exactLength.value,t.exactLength.message,e),vn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Byt(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?vn(r,"minimum",n.value,n.message,e):vn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),vn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?vn(r,"maximum",n.value,n.message,e):vn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),vn(r,"maximum",n.value,n.message,e));break;case"multipleOf":vn(r,"multipleOf",n.value,n.message,e);break}return r}function $yt(){return{type:"boolean"}}function qyt(t,e){return Bt(t.type._def,e)}var Uyt=(t,e)=>Bt(t.innerType._def,e);function hxe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>hxe(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return TFr(t,e)}}var TFr=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":vn(r,"minimum",n.value,n.message,e);break;case"max":vn(r,"maximum",n.value,n.message,e);break}return r};function zyt(t,e){return{...Bt(t.innerType._def,e),default:t.defaultValue()}}function Hyt(t,e,r){return e.effectStrategy==="input"?Bt(t.schema._def,e,r):{}}function Vyt(t){return{type:"string",enum:[...t.values]}}var MFr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Wyt(t,e){let r=[Bt(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Bt(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(MFr(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 Jyt(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}Pd();var mxe,g1={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:()=>(mxe===void 0&&(mxe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),mxe),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 JZ(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?AFr(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":vn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":vn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":kg(r,"email",o.message,e);break;case"format:idn-email":kg(r,"idn-email",o.message,e);break;case"pattern:zod":Bg(r,g1.email,o.message,e);break}break;case"url":kg(r,"uri",o.message,e);break;case"uuid":kg(r,"uuid",o.message,e);break;case"regex":Bg(r,o.regex,o.message,e);break;case"cuid":Bg(r,g1.cuid,o.message,e);break;case"cuid2":Bg(r,g1.cuid2,o.message,e);break;case"startsWith":Bg(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Bg(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":kg(r,"date-time",o.message,e);break;case"date":kg(r,"date",o.message,e);break;case"time":kg(r,"time",o.message,e);break;case"duration":kg(r,"duration",o.message,e);break;case"length":vn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),vn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Bg(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&kg(r,"ipv4",o.message,e),o.version!=="v4"&&kg(r,"ipv6",o.message,e);break}case"emoji":Bg(r,g1.emoji,o.message,e);break;case"ulid":{Bg(r,g1.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{kg(r,"binary",o.message,e);break}case"contentEncoding:base64":{vn(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Bg(r,g1.base64,o.message,e);break}}break}case"nanoid":Bg(r,g1.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:(i=>{})(o)}return r}var AFr=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),kg=(t,e,r,n)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):vn(t,"format",e,r,n)},Bg=(t,e,r,n)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Gyt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):vn(t,"pattern",Gyt(e,n),r,n)},Gyt=(t,e)=>{let r=typeof t=="function"?t():t;if(!e.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,i="",a=!1,s=!1,u=!1;for(let l=0;l<o.length;l++){if(a){i+=o[l],a=!1;continue}if(n.i){if(s){if(o[l].match(/[a-z]/)){u?(i+=o[l],i+=`${o[l-2]}-${o[l]}`.toUpperCase(),u=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(i+=o[l],u=!0):i+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){i+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){i+=`(^|(?<=[\r
]))`;continue}else if(o[l]==="$"){i+=`($|(?=[\r
]))`;continue}}if(n.s&&o[l]==="."){i+=s?`${o[l]}\r
`:`[${o[l]}\r
]`;continue}i+=o[l],o[l]==="\\"?a=!0:s&&o[l]==="]"?s=!1:!s&&o[l]==="["&&(s=!0)}try{let l=new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return i};function GZ(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Bt(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Bt(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===ne.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(JZ(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}function Kyt(t,e){if(e.mapStrategy==="record")return GZ(t,e);let r=Bt(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Bt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Yyt(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Xyt(){return{not:{}}}function Zyt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var R3={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ebt(t,e){if(e.target==="openApi3")return Qyt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in R3&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=R3[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 Qyt(t,e)}var Qyt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Bt(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function tbt(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"||e.nullableStrategy==="property"?{type:R3[t.innerType._def.typeName],nullable:!0}:{type:[R3[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Bt(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Bt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function rbt(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",pxe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?vn(r,"minimum",n.value,n.message,e):vn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),vn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?vn(r,"maximum",n.value,n.message,e):vn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),vn(r,"maximum",n.value,n.message,e));break;case"multipleOf":vn(r,"multipleOf",n.value,n.message,e);break}return r}function RFr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Bt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Bt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function nbt(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=Bt(i._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});return a===void 0?n:{properties:{...n.properties,[o]:a},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:RFr(t,e)};return r.required.length||delete r.required,r}var obt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Bt(t.innerType._def,e);let r=Bt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var ibt=(t,e)=>{if(e.pipeStrategy==="input")return Bt(t.in._def,e);if(e.pipeStrategy==="output")return Bt(t.out._def,e);let r=Bt(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Bt(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function abt(t,e){return Bt(t.type._def,e)}function sbt(t,e){let n={type:"array",uniqueItems:!0,items:Bt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&vn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&vn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function ubt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Bt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Bt(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Bt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function lbt(){return{not:{}}}function cbt(){return{}}var dbt=(t,e)=>Bt(t.innerType._def,e);function Bt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Dyt)return a}if(n&&!r){let a=IFr(n,e);if(a!==void 0)return"$ref"in a&&e.seenRefs.add(a.$ref),a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=jFr(t,t.typeName,e,r);return i&&NFr(t,e,i),o.jsonSchema=i,i}var IFr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let r=t.path.slice(e.basePath.length+1).join("_");return r!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[r]=t.def),{$ref:[...e.basePath,e.definitionPath,r].join("/")};case"relative":return{$ref:DFr(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,o)=>e.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},DFr=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},jFr=(t,e,r,n)=>{switch(e){case ne.ZodString:return JZ(t,r);case ne.ZodNumber:return rbt(t,r);case ne.ZodObject:return nbt(t,r);case ne.ZodBigInt:return Byt(t,r);case ne.ZodBoolean:return $yt();case ne.ZodDate:return hxe(t,r);case ne.ZodUndefined:return lbt();case ne.ZodNull:return Zyt(r);case ne.ZodArray:return kyt(t,r);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return ebt(t,r);case ne.ZodIntersection:return Wyt(t,r);case ne.ZodTuple:return ubt(t,r);case ne.ZodRecord:return GZ(t,r);case ne.ZodLiteral:return Jyt(t,r);case ne.ZodEnum:return Vyt(t);case ne.ZodNativeEnum:return Yyt(t);case ne.ZodNullable:return tbt(t,r);case ne.ZodOptional:return obt(t,r);case ne.ZodMap:return Kyt(t,r);case ne.ZodSet:return sbt(t,r);case ne.ZodLazy:return Bt(t.getter()._def,r);case ne.ZodPromise:return abt(t,r);case ne.ZodNaN:case ne.ZodNever:return Xyt();case ne.ZodEffects:return Hyt(t,r,n);case ne.ZodAny:return Fyt();case ne.ZodUnknown:return cbt();case ne.ZodDefault:return zyt(t,r);case ne.ZodBranded:return qyt(t,r);case ne.ZodReadonly:return dbt(t,r);case ne.ZodCatch:return Uyt(t,r);case ne.ZodPipeline:return ibt(t,r);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return(o=>{})(e)}},NFr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var fbt=(t,e)=>{let r=Lyt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Bt(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(Nyt(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]=Bt(A3(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 pbt(t,e){return fbt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function hbt(t,e,r){return myt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:pbt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function mbt(t){return gyt({type:"function",function:{name:t.name,parameters:pbt(t.parameters,{name:t.name}),strict:!0,...t.description?{description:t.description}:void 0}},{callback:t.function,parser:e=>t.parameters.parse(JSON.parse(e))})}function aT(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}hh();function I3(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function y1(t){let e;return t.constructor.name===jg.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===ls.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=I3(t,"INVALID_TOOL_RESULTS"):t.status===401?e=I3(t,"MODEL_AUTHENTICATION"):t.status===429?e=I3(t,"MODEL_RATE_LIMIT"):t.status===404?e=I3(t,"MODEL_NOT_FOUND"):e=t,e}function gbt(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function LFr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function ybt(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(bbt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function bbt(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${KZ(o,e)},`):r.push(`${n}?: ${KZ(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function KZ(t,e){if(LFr(t))return t.anyOf.map(r=>KZ(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",bbt(t,e+2),"}"].join(`
`);case"array":return t.items?`${KZ(t.items,e)}[]`:"any[]";default:return""}}function _bt(t,e){let r;if(Ig(t)){let n=mbt({name:t.name,parameters:t.schema,description:t.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...e?.strict!==void 0?{strict:e.strict}:{}}}:r={type:"function",function:uZ(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function FFr(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function wbt(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Gl.isInstance(t))throw new Error("Invalid generic chat message");return FFr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function gxe(t,e){return t.flatMap(r=>{let n=wbt(r);n==="system"&&e?.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),Gu(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Bk),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 vbt(t,e){return Vw(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:_bt(t,e)}var nS=class extends ba{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(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??Yt("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??Yt("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.maxTokens=e?.maxTokens,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this?.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>vbt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&YZ(e.json_schema.schema)?hbt(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling);let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,max_tokens:this.maxTokens===-1?void 0:this.maxTokens,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>vbt(s,{strict:n})):void 0,tool_choice:gbt(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(m1(u,{returnId:!0}))}catch(l){i.push($k(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new To({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Gl(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new sp({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new Dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new ph({content:i,response_metadata:s}):o==="developer"?new ph({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Hm({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Oy({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new ap({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){let o=gxe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new Ho({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 Ho({message:new Dr({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=gxe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let h of s?.choices??[]){let v={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};v.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Gu(v.message)&&(v.message.usage_metadata=o),v.message=new To(Object.fromEntries(Object.entries(v.message).filter(([g])=>!g.startsWith("lc_")))),p.push(v)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=ybt(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(wbt(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw y1(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw y1(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=aT(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Ar(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;kFr(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),YZ(n)?u=ox.fromZodSchema(n):u=new ix;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}}}),YZ(n)?u=ox.fromZodSchema(n):u=new ix;else{let f=o??"extract";if(YZ(n)){let p=Bi(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 Fg({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 Fg({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=$i.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=$i.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ai.from([{raw:s},d])}};function YZ(t){return typeof t?.parse=="function"}function kFr(t){return t!==void 0&&typeof t.schema=="object"}uC();Vh();var gC=class extends Ip{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"text-embedding-ada-002"}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:512}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey??r?.openAIApiKey??Yt("OPENAI_API_KEY");this.organization=r?.configuration?.organization??Yt("OPENAI_ORGANIZATION"),this.model=r?.model??r?.modelName??this.model,this.modelName=this.model,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.timeout=r?.timeout,this.dimensions=r?.dimensions,this.clientConfig={apiKey:n,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let r=Dg(this.stripNewLines?e.map(a=>a.replace(/\n/g," ")):e,this.batchSize),n=r.map(a=>{let s={model:this.model,input:a};return this.dimensions&&(s.dimensions=this.dimensions),this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{data:u}=o[a];for(let l=0;l<s.length;l+=1)i.push(u[l].embedding)}return i}async embedQuery(e){let r={model:this.model,input:this.stripNewLines?e.replace(/\n/g," "):e};this.dimensions&&(r.dimensions=this.dimensions);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=aT(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Ar(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw y1(n)}})}};Pd();tE();c3();Ey();Pj();Mj();o5();var XZ=class extends QF{get lc_namespace(){return["langchain","tools"]}constructor(e){super(e??{}),Object.defineProperty(this,"returnDirect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"verboseParsingErrors",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"content"}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat}async invoke(e,r){let n,o,i=jr(r);return Oj(e)?(n=e.id,o=e.args,i={...i,toolCall:e,configurable:{...i.configurable,tool_call_id:n}}):o=e,this.call(o,i)}async call(e,r,n){let o;try{o=await this.schema.parseAsync(e)}catch(p){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${p.message}`),new Cj(h,JSON.stringify(e))}let i=vA(r),s=await _i.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=BFr({content:l,artifact:c,toolCallId:d,name:this.name});return await s?.handleToolEnd(f),f}},D3=class extends XZ{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Pr.object({input:Pr.string().optional()}).transform(r=>r.input)})}call(e,r){return super.call(typeof e=="string"||!e?{input:e}:e,r)}},yxe=class extends D3{static lc_name(){return"DynamicTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,r){let n=vA(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},bxe=class extends XZ{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=kf(e.schema)?e.schema:Pr.object({}).passthrough()}async call(e,r,n){let o=vA(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}};function Lp(t,e){if(!e.schema||kf(e.schema)&&(!("shape"in e.schema)||!e.schema.shape))return new yxe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(n,o,i)=>new Promise((a,s)=>{let u=La(i,{callbacks:o?.getChild()});Hc.runWithConfig(up(u),async()=>{try{a(t(n,u))}catch(l){s(l)}})})});let r=e.description??e.schema.description??`${e.name} tool`;return new bxe({...e,description:r,schema:e.schema,func:async(n,o,i)=>new Promise((a,s)=>{let u=La(i,{callbacks:o?.getChild()});Hc.runWithConfig(up(u),async()=>{try{a(t(n,u))}catch(l){s(l)}})})})}function BFr(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!tLe(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new ex({content:e,artifact:r,tool_call_id:n,name:t.name}):new ex({content:$Fr(e),artifact:r,tool_call_id:n,name:t.name}):e}function $Fr(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var _xe=class extends D3{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??Yt("OPENAI_API_KEY"),n=e?.organization??Yt("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Ar(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(_xe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Sbt=require("obsidian");var ZZ=class extends Ip{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"jina-clip-v2"}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:24}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"https://api.jina.ai/v1/embeddings"}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:1024}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"normalized",{enumerable:!0,configurable:!0,writable:!0,value:!0});let n=r?.apiKey||Yt("JINA_API_KEY")||Yt("JINA_AUTH_TOKEN");if(!n)throw new Error("Jina API key not found");this.apiKey=n,this.model=r?.model??this.model,this.dimensions=r?.dimensions??this.dimensions,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.normalized=r?.normalized??this.normalized}doStripNewLines(e){return this.stripNewLines?e.map(r=>typeof r=="string"?r.replace(/\n/g," "):r.text?{text:r.text.replace(/\n/g," ")}:r):e}async embedDocuments(e){let r=Dg(this.doStripNewLines(e),this.batchSize),n=r.map(a=>{let s=this.getParams(a);return this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],u=o[a]||[];for(let l=0;l<s.length;l+=1)i.push(u[l])}return i}async embedQuery(e){let r=this.getParams(this.doStripNewLines([e]),!0);return(await this.embeddingWithRetry(r)||[[]])[0]}getParams(e,r){return{model:this.model,input:e,dimensions:this.dimensions,task:r?"retrieval.query":"retrieval.passage",normalized:this.normalized}}async embeddingWithRetry(e){let n=await(await fetch(this.baseUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(e)})).json();if("detail"in n&&n.detail)throw new Error(`${n.detail}`);return n.data.map(({embedding:o})=>o)}};var QZ=class extends ZZ{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}};var qFr={["copilot-plus"]:gC,["copilot-plus-jina"]:QZ,["openai"]:gC,["cohereai"]:pZ,["google"]:_Z,["azure openai"]:gC,["ollama"]:xZ,["lm-studio"]:gC,["3rd party (openai-format)"]:gC},vo=class{constructor(){this.providerApiKeyMap={["copilot-plus"]:()=>me().plusLicenseKey,["copilot-plus-jina"]:()=>me().plusLicenseKey,["openai"]:()=>me().openAIApiKey,["cohereai"]:()=>me().cohereApiKey,["google"]:()=>me().googleApiKey,["azure openai"]:()=>me().azureOpenAIApiKey,["ollama"]:()=>"default-key",["lm-studio"]:()=>"default-key",["3rd party (openai-format)"]:()=>""};this.initialize(),bl(()=>this.initialize())}initialize(){let e=me().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return vo.instance||(vo.instance=new vo),vo.instance}getProviderConstructor(e){let r=qFr[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}buildModelMap(e){vo.modelMap={};let r=vo.modelMap;e.forEach(n=>{if(n.enabled){if(!Object.values(fE).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=an(n);r[a]={hasApiKey:Boolean(i),EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=an(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=me();if(!vo.modelMap.hasOwnProperty(e))throw new ir(`No embedding model found for: ${e}`);let r=vo.modelMap[e];if(!r.hasApiKey)throw new ir(`API key is not provided for the embedding model: ${e}`);let n=this.getCustomModel(e),o=await this.getEmbeddingConfig(n);try{return vo.embeddingModel=new r.EmbeddingConstructor(o),vo.embeddingModel}catch(i){throw new ir(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=me(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={["copilot-plus"]:{modelName:n,apiKey:await Qo(r.plusLicenseKey),timeout:1e4,batchSize:me().embeddingBatchSize,configuration:{baseURL:LA,fetch:e.enableCors?Kl:void 0}},["copilot-plus-jina"]:{model:n,apiKey:await Qo(r.plusLicenseKey),timeout:1e4,batchSize:me().embeddingBatchSize,dimensions:e.dimensions,baseUrl:LA+"/embeddings",configuration:{fetch:e.enableCors?Kl:void 0}},["openai"]:{modelName:n,apiKey:await Qo(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:me().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Kl:void 0}},["cohereai"]:{model:n,apiKey:await Qo(e.apiKey||r.cohereApiKey)},["google"]:{modelName:n,apiKey:await Qo(r.googleApiKey)},["azure openai"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:e.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiEmbeddingDeploymentName||r.azureOpenAIApiEmbeddingDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},fetch:e.enableCors?Kl:void 0}},["ollama"]:{baseUrl:e.baseUrl||"http://localhost:11434",model:n,truncate:!0},["lm-studio"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Kl:void 0}},["3rd party (openai-format)"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||""),batchSize:me().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Kl:void 0,dangerouslyAllowBrowser:!0}}}[e.provider]||{};return{...o,...a}}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getEmbeddingConfig(o);await new(this.getProviderConstructor(o))(i).embedQuery("test")};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new Sbt.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: `+ia(n)+`
with CORS Error: `+ia(o);throw new Error(i)}}}};var V3=require("obsidian");var xbt={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"},Cbt={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},j3=Object.keys(xbt);function Obt(t){return t!==void 0&&j3.includes(t)?xbt[t]:void 0}var UFr=Date.now().toString().slice(5),zFr=0;var Ebt=BigInt(1e3),Pbt=BigInt(1e6),Tbt=BigInt(1e9);var vxe=65535;function ti(t,e){if(e.length<vxe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=vxe)Array.prototype.push.apply(t,e.slice(n,n+vxe))}}function Abt(t,...e){return t.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...r){let n=r[r.length-1],{width:o,type:i,position:a}=n,s=a?e[Number.parseInt(a)-1]:e.shift(),u=o===""?0:Number.parseInt(o);switch(i){case"d":return s.toString().padStart(u,"0");case"f":{let l=s,[c,d]=o.split(".").map(f=>Number.parseFloat(f));return typeof d=="number"&&d>=0&&(l=l.toFixed(d)),typeof c=="number"&&c>=0?l.toString().padStart(u,"0"):l.toString()}case"s":return u<0?s.toString().padEnd(-u," "):s.toString().padStart(u," ");default:return s}})}function HFr(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function VFr(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Mbt(){return BigInt(Math.floor(performance.now()*1e6))}function b1(t){return typeof t=="number"&&(t=BigInt(t)),t<Ebt?`${t}ns`:t<Pbt?`${t/Ebt}\u03BCs`:t<Tbt?`${t/Pbt}ms`:`${t/Tbt}s`}function $g(){return HFr()?Mbt():VFr()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Mbt():BigInt(0)}function N3(){return`${UFr}-${zFr++}`}function qk(t,e){return Object.hasOwn===void 0?Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0:Object.hasOwn(t,e)?t[e]:void 0}function Rbt(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function Uk(t){if(t.length===0)return[];if(t.length===1)return t[0];for(let r=1;r<t.length;r++)if(t[r].length<t[0].length){let n=t[0];t[0]=t[r],t[r]=n}let e=new Map;for(let r of t[0])e.set(r,1);for(let r=1;r<t.length;r++){let n=0;for(let o of t[r]){let i=e.get(o);i===r&&(e.set(o,i+1),n++)}if(n===0)return[]}return t[0].filter(r=>{let n=e.get(r);return n!==void 0&&e.set(r,0),n===t.length})}function eQ(t,e){let r={},n=e.length;for(let o=0;o<n;o++){let i=e[o],a=i.split("."),s=t,u=a.length;for(let l=0;l<u;l++)if(s=s[a[l]],typeof s=="object"){if(s!==null&&"lat"in s&&"lon"in s&&typeof s.lat=="number"&&typeof s.lon=="number"){s=r[i]=s;break}else if(!Array.isArray(s)&&s!==null&&l===u-1){s=void 0;break}}else if((s===null||typeof s!="object")&&l<u-1){s=void 0;break}typeof s<"u"&&(r[i]=s)}return r}function zk(t,e){return eQ(t,[e])[e]}var WFr={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function wxe(t,e){let r=WFr[e];if(r===void 0)throw new Error(vt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function tQ(t,e){t.hits=t.hits.map(r=>({...r,document:{...r.document,...e.reduce((n,o)=>{let i=o.split("."),a=i.pop(),s=n;for(let u of i)s[u]=s[u]??{},s=s[u];return s[a]=null,n},r.document)}}))}function Cs(t){return t?.constructor?.name==="AsyncFunction"}var JFr=j3.join(`
- `),GFr={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:
- ${JFr}`,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 vt(t,...e){let r=new Error(Abt(GFr[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function Ibt(t){return{raw:Number(t),formatted:b1(t)}}function Dbt(t){if(t.id){if(typeof t.id!="string")throw vt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return N3()}function Sxe(t,e){for(let[r,n]of Object.entries(e)){let o=t[r];if(!(typeof o>"u")&&!(n==="geopoint"&&typeof o=="object"&&typeof o.lon=="number"&&typeof o.lat=="number")&&!(n==="enum"&&(typeof o=="string"||typeof o=="number"))){if(n==="enum[]"&&Array.isArray(o)){let i=o.length;for(let a=0;a<i;a++)if(typeof o[a]!="string"&&typeof o[a]!="number")return r+"."+a;continue}if(yC(n)){let i=Cxe(n);if(!Array.isArray(o)||o.length!==i)throw vt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(Hk(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=Sxe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}var KFr={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},YFr={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function jbt(t){return t==="geopoint"}function yC(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function Hk(t){return typeof t=="string"&&KFr[t]}function xxe(t){return YFr[t]}function Cxe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw vt("INVALID_VECTOR_VALUE",t);case e<=0:throw vt("INVALID_VECTOR_SIZE",t);default:return e}}function Nbt(){return{idToInternalId:new Map,internalIdToId:[],save:XFr,load:ZFr}}function XFr(t){return{internalIdToId:t.internalIdToId}}function ZFr(t,e){let{internalIdToId:r}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;o<n;o++){let i=r[o];t.internalDocumentIDStore.idToInternalId.set(i,o+1),t.internalDocumentIDStore.internalIdToId.push(i)}}function $o(t,e){if(typeof e=="string"){let r=t.idToInternalId.get(e);if(r)return r;let n=t.idToInternalId.size+1;return t.idToInternalId.set(e,n),t.internalIdToId.push(e),n}return e>t.internalIdToId.length?$o(t,e.toString()):e}function Jh(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}function ekr(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function tkr(t,e){let r=$o(t.sharedInternalDocumentStore,e);return t.docs[r]}function rkr(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=$o(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function nkr(t){return t.docs}function okr(t,e,r){let n=$o(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function ikr(t,e){let r=$o(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function akr(t){return t.count}function skr(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function ukr(t){return{docs:t.docs,count:t.count}}function Lbt(){return{create:ekr,get:tkr,getMultiple:rkr,getAll:nkr,store:okr,remove:ikr,count:akr,load:skr,save:ukr}}var Fbt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"];function kbt(t,e){let r=[],n=t.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let i=t.plugins[o];typeof i[e]=="function"&&r.push(i[e])}catch(i){throw console.error("Caught error in getAllPluginsByHook:",i),vt("PLUGIN_CRASHED")}return r}var Bbt=["tokenizer","index","documentsStore","sorter"],Oxe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function qg(t,e,r,n){if(t.some(Cs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function _1(t,e,r){if(t.some(Cs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function Vk(t,e,r,n,o){if(t.some(Cs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function Wk(t,e,r,n){if(t.some(Cs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function $bt(t,e){if(t.some(Cs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}function Exe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(Gh(t.l),Gh(t.r))+1,e.h=Math.max(Gh(e.l),Gh(e.r))+1,e}function Pxe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(Gh(t.l),Gh(t.r))+1,e.h=Math.max(Gh(e.l),Gh(e.r))+1,e}function Ubt(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&ti(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function Txe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k>=e&&ti(n,i.v),!r&&i.k>e&&ti(n,i.v),o.push(i.r),o.push(i.l))}return n}function Mxe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k<=e&&ti(n,i.v),!r&&i.k<e&&ti(n,i.v),o.push(i.r),o.push(i.l))}return n}function zbt(t,e){for(;t!==null;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}function Hbt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}var qbt=0;function Vbt(t,e,r,n=500){function o(i,a,s){if(i===null)return qbt++,{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 qbt%n===0?ckr(i,a):i}t.root=o(t.root,e,r)}function ckr(t,e){t.h=1+Math.max(Gh(t.l),Gh(t.r));let r=Gh(t.l)-Gh(t.r);return r>1&&e<t.l.k?Pxe(t):r<-1&&e>t.r.k?Exe(t):r>1&&e>t.l.k?(t.l=Exe(t.l),Pxe(t)):r<-1&&e<t.r.k?(t.r=Pxe(t.r),Exe(t)):t}function Gh(t){return t!==null?t.h:-1}function Wbt(t,e){let r=zbt(t.root,e);return r===null?null:r.v}function dkr(t,e){if(t===null||t.root===null)return;let r=t.root,n=null;for(;r!=null&&r.k!==e;)n=r,e<r.k?r=r.l:r=r.r;if(r===null)return;(()=>{if(r.l===null&&r.r===null)n===null?t.root=null:n.l===r?n.l=null:n.r=null;else if(r.l!=null&&r.r!=null){let i=r.r,a=r;for(;i.l!=null;)a=i,i=i.l;r.k=i.k,a===r?a.r=i.r:a.l=i.r}else{let i=r.l!=null?r.l:r.r;n===null?t.root=i:n.l===r?n.l=i:n.r=i}})()}function Jbt(t,e,r){let n=zbt(t.root,r);if(n){if(n.v.length===1){dkr(t,r);return}n.v.splice(n.v.indexOf(e),1)}}function Gbt(){return{numberToDocumentId:new Map}}function Kbt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function Ybt(t,e,r){t?.numberToDocumentId.set(r,t?.numberToDocumentId.get(r)?.filter(n=>n!==e)??[]),t?.numberToDocumentId.get(r)?.length===0&&t?.numberToDocumentId.delete(r)}function Xbt(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"eq":{let o=e[n];return t.numberToDocumentId.get(o)??[]}case"in":{let o=e[n],i=[];for(let a of o){let s=t.numberToDocumentId.get(a);s!=null&&ti(i,s)}return i}case"nin":{let o=e[n],i=[],a=t.numberToDocumentId.keys();for(let s of a){if(o.includes(s))continue;let u=t.numberToDocumentId.get(s);u!=null&&ti(i,u)}return i}}throw new Error("Invalid operation")}function Zbt(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"containsAll":{let i=e[n].map(a=>t.numberToDocumentId.get(a)??[]);return Uk(i)}}throw new Error("Invalid operation")}function fkr(t,e,r){if(r<0)return-1;if(t===e)return 0;let n=t.length,o=e.length;if(n===0)return o<=r?o:-1;if(o===0)return n<=r?n:-1;if(t=t.toLowerCase(),e=e.toLowerCase(),e.startsWith(t)||t.startsWith(e))return 0;if(Math.abs(n-o)>r)return-1;let i=[];for(let a=0;a<=n;a++){i[a]=[a];for(let s=1;s<=o;s++)i[a][s]=a===0?s:0}for(let a=1;a<=n;a++){let s=1/0;for(let u=1;u<=o;u++)t[a-1]===e[u-1]?i[a][u]=i[a-1][u-1]:i[a][u]=Math.min(i[a-1][u]+1,i[a][u-1]+1,i[a-1][u-1]+1),s=Math.min(s,i[a][u]);if(s>r)return-1}return i[n][o]<=r?i[n][o]:-1}function Axe(t,e,r){let n=fkr(t,e,r);return{distance:n,isBounded:n>=0}}var Rxe=class{constructor(e,r,n){Vl(this,"k");Vl(this,"s");Vl(this,"c",{});Vl(this,"d",[]);Vl(this,"e");Vl(this,"w","");this.k=e,this.s=r,this.e=n}toJSON(){return{w:this.w,s:this.s,c:this.c,d:this.d,e:this.e}}};function Jk(t,e){t.w=e.w+t.s}function rQ(t,e){t.d.push(e)}function pkr(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function Ixe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(qk(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&Axe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),qk(e,i)!=null&&a.length>0){let s=new Set(e[i]),u=a.length;for(let l=0;l<u;l++)s.add(a[l]);e[i]=Array.from(s)}}for(let i of Object.keys(t.c))Ixe(t.c[i],e,r,n,o);return e}function Qbt(t,e){let r="",n=Math.min(t.length,e.length);for(let o=0;o<n;o++){if(t[o]!==e[o])return r;r+=t[o]}return r}function v1(t=!1,e="",r=""){return new Rxe(r,e,t)}function e_t(t,e,r){let n=e.length;for(let o=0;o<n;o++){let i=e[o],a=e.substring(o),s=t.c[i];if(s){let u=s.s,l=u.length,c=Qbt(u,a),d=c.length;if(u===a){rQ(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=v1(!0,a,i);p.c[f]=s;let h=p.c[f];h.s=u.substring(d),h.k=f,t.c[i]=p,Jk(p,t),Jk(h,p),rQ(p,r);return}if(d<l&&d<a.length){let p=v1(!1,c,i);p.c[f]=s,t.c[i]=p;let h=p.c[f];h.s=u.substring(d),h.k=f;let m=a[d],v=v1(!0,e.substring(o+d),m);rQ(v,r),p.c[m]=v,Jk(p,t),Jk(v,p),Jk(h,p);return}o+=l-1,t=s}else{let u=v1(!0,a,i);rQ(u,r),t.c[i]=u,Jk(u,t);return}}}function L3(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){Ixe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(Axe(e,a,o).isBounded&&(i[a]=[]),qk(i,a)!=null&&s.length>0)){let u=new Set(i[a]),l=s.length;for(let c=0;c<l;c++)u.add(s[c]);i[a]=Array.from(u)}}if(!(r>=e.length)){e[r]in t.c&&L3(t.c[e[r]],e,r+1,n,o,i),L3(t,e,r+1,n-1,o,i);for(let a in t.c)L3(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&L3(t.c[a],e,r+1,n-1,o,i)}}}function Dxe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,L3(t,e,0,n||0,n,o),o}else{let o=e.length;for(let a=0;a<o;a++){let s=e[a];if(s in t.c){let u=t.c[s],l=u.s,c=e.substring(a),f=Qbt(l,c).length;if(f!==l.length&&f!==c.length){if(n)break;return{}}a+=u.s.length-1,t=u}else return{}}let i={};return Ixe(t,i,e,r,n),i}}function t_t(t,e,r,n=!0){if(!e)return!0;let o=e.length;for(let i=0;i<o;i++){let a=e[i];if(a in t.c){let s=t.c[a];i+=s.s.length-1,t=s,n&&t.w!==e||pkr(t,r)}else return!1}return!0}function r_t(){return{root:null}}function n_t(t,e,r){let n={point:e,docIDs:r};if(t.root==null){t.root=n;return}let o=t.root,i=0;for(;o!==null;){if(o.point.lon===e.lon&&o.point.lat===e.lat){let s=o.docIDs??[];o.docIDs=Array.from(new Set([...s,...r||[]]));return}if(i%2===0)if(e.lon<o.point.lon){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}else if(e.lat<o.point.lat){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}i++}}function o_t(t,e,r){let n=t.root,o=0,i=null,a=null;for(;n!==null;){if(n?.point.lon===e.lon&&n.point.lat===e.lat){let u=n.docIDs?.indexOf(r);if(u!==void 0&&u>-1){n.docIDs?.splice(u,1),(n.docIDs==null||n.docIDs.length===0)&&(i!=null?a==="left"?i.left=n.left!==null?n.left:n.right:a==="right"&&(i.right=n.right!==null?n.right:n.left):t.root=n.left!==null?n.left:n.right);return}}let s=o%2;i=n,s===0?e.lon<n.point.lon?(n=n?.left,a="left"):(n=n?.right,a="right"):e.lat<n.point.lat?(n=n?.left,a="left"):(n=n?.right,a="right"),o++}}function i_t(t,e,r,n=!0,o="asc",i=!1){let a=i?u_t:s_t,s=[{node:t,depth:0}],u=[];for(;s.length>0;){let{node:l,depth:c}=s.pop();if(l===null)continue;let d=a(e,l.point);(n?d<=r:d>r)&&u.push({point:l.point,docIDs:l.docIDs??[]}),l.left!=null&&s.push({node:l.left,depth:c+1}),l.right!=null&&s.push({node:l.right,depth:c+1})}return o&&u.sort((l,c)=>{let d=a(e,l.point),f=a(e,c.point);return o.toLowerCase()==="asc"?d-f:f-d}),u}function a_t(t,e,r=!0,n=null,o=!1){let i=[{node:t,depth:0}],a=[];for(;i.length>0;){let u=i.pop();if(u==null||u.node==null)continue;let{node:l,depth:c}=u,d=c+1;l.left!=null&&i.push({node:l.left,depth:d}),l.right!=null&&i.push({node:l.right,depth:d});let f=mkr(e,l.point);f&&r?a.push({point:l.point,docIDs:l.docIDs??[]}):!f&&!r&&a.push({point:l.point,docIDs:l.docIDs??[]})}let s=hkr(e);if(n){let u=o?u_t:s_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 hkr(t){let e=0,r=0,n=0,o=t.length;for(let a=0,s=o-1;a<o;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat,f=u*d-c*l;e+=f,r+=(u+c)*f,n+=(l+d)*f}e/=2;let i=6*e;return r/=i,n/=i,{lon:r,lat:n}}function mkr(t,e){let r=!1,n=e.lon,o=e.lat,i=t.length;for(let a=0,s=i-1;a<i;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat;l>o!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function s_t(t,e){let r=Math.PI/180,n=t.lat*r,o=e.lat*r,i=(e.lat-t.lat)*r,a=(e.lon-t.lon)*r,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(a/2)*Math.sin(a/2);return 6371e3*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}function u_t(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),h=Math.cos(c),m=u,v,g=1e3,_,S,x,O,T;do{let k=Math.sin(m),F=Math.cos(m);x=Math.sqrt(h*k*(h*k)+(f*p-d*h*F)*(f*p-d*h*F)),O=d*p+f*h*F,T=Math.atan2(x,O),_=f*h*k/x,S=1-_*_;let L=O-2*d*p/S,q=n/16*S*(4+n*(4-3*S));v=m,m=u+(1-q)*n*_*(T+q*x*(L+q*O*(-1+2*L*L)))}while(Math.abs(m-v)>1e-12&&--g>0);let E=S*(6378137*6378137-o*o)/(o*o),M=1+E/16384*(4096+E*(-768+E*(320-175*E))),R=E/1024*(256+E*(-128+E*(74-47*E))),N=R*x*(O-2*d*p/S+R/4*(O*(-1+2*x*x)-R/6*T*(-3+4*x*x)*(-3+4*T*T)));return o*M*(T-N)}function nQ(t,e,r=0,n){if(e===0)throw vt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let m=0;m<i;m++){let v=t[m],g=v.length;for(let _=0;_<g;_++){let[S,x]=v[_],O=x*e,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,v)=>v[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,v)=>m[2]>v[2]?-1:m[2]<v[2]?1:m[1]>v[1]?-1:m[1]<v[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 jxe(t,e,r,n,o,{k:i,b:a,d:s}){return Math.log(1+(r-e+.5)/(e+.5))*(s+t*(i+1))/(t+i*(1-a+a*n/o))}function Nxe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function oQ(t,e,r,n=.8){let o=Nxe(t,r),i=[];for(let[a,[s,u]]of Object.entries(e)){let l=0;for(let d=0;d<r;d++)l+=t[d]*u[d];let c=l/(o*s);c>=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}function gkr(t,e,r,n,o){let i=$o(t.sharedInternalDocumentStore,r);t.avgFieldLength[e]=((t.avgFieldLength[e]??0)*(o-1)+n.length)/o,t.fieldLengths[e][i]=n.length,t.frequencies[e][i]={}}function ykr(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=$o(t.sharedInternalDocumentStore,r),s=i/n.length;t.frequencies[e][a][o]=s,o in t.tokenOccurrences[e]||(t.tokenOccurrences[e][o]=0),t.tokenOccurrences[e][o]=(t.tokenOccurrences[e][o]??0)+1}function bkr(t,e,r,n){let o=$o(t.sharedInternalDocumentStore,r);n>1?t.avgFieldLength[e]=(t.avgFieldLength[e]*n-t.fieldLengths[e][o])/(n-1):t.avgFieldLength[e]=void 0,t.fieldLengths[e][o]=void 0,t.frequencies[e][o]=void 0}function _kr(t,e,r){t.tokenOccurrences[e][r]--}function vkr(t,e,r,n,o){let i=Array.from(o),a=e.avgFieldLength[r],s=e.fieldLengths[r],u=e.tokenOccurrences[r],l=e.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let h=$o(e.sharedInternalDocumentStore,i[p]),m=l?.[h]?.[n]??0,v=jxe(m,c,t.docsCount,s[h],a,t.params.relevance);d.push([h,v])}return d}function c_t(t,e,r,n,o=""){n||(n={sharedInternalDocumentStore:e,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}});for(let[i,a]of Object.entries(r)){let s=`${o}${o?".":""}${i}`;if(typeof a=="object"&&!Array.isArray(a)){c_t(t,e,a,n,s);continue}if(yC(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:Cxe(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:Hbt(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:v1(),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:Gbt(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:r_t(),isArray:u};break;default:throw vt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function wkr(t,e,r,n,o,i,a,s){return u=>{let l=$o(e.sharedInternalDocumentStore,n),{type:c,node:d}=e.indexes[r];switch(c){case"Bool":{d[u?"true":"false"].push(l);break}case"AVL":{let f=s?.avlRebalanceThreshold??1;Vbt(d,u,[l],f);break}case"Radix":{let f=i.tokenize(u,o,r);t.insertDocumentScoreParameters(e,r,l,f,a);for(let p of f)t.insertTokenScoreParameters(e,r,l,f,p),e_t(d,p,l);break}case"Flat":{Kbt(d,u,l);break}case"BKD":{n_t(d,u,[l]);break}}}}function Skr(t,e,r,n,o,i,a,s,u,l){if(yC(i))return xkr(e,r,o,n);let c=wkr(t,e,r,n,a,s,u,l);if(!Hk(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function xkr(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=Nxe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function l_t(t,e,r,n,o,i,a,s,u){let l=$o(e.sharedInternalDocumentStore,n);if(yC(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return Jbt(d,l,o),!0;case"Bool":{let p=d[o?"true":"false"].indexOf(l);return d[o?"true":"false"].splice(p,1),!0}case"Radix":{let f=s.tokenize(o,a,r);t.removeDocumentScoreParameters(e,r,n,u);for(let p of f)t.removeTokenScoreParameters(e,r,p),t_t(d,p,l);return!0}case"Flat":return Ybt(d,l,o),!0;case"BKD":return o_t(d,o,l),!1}}function Ckr(t,e,r,n,o,i,a,s,u){if(!Hk(i))return l_t(t,e,r,n,o,i,a,s,u);let l=xxe(i),c=o,d=c.length;for(let f=0;f<d;f++)l_t(t,e,r,n,c[f],l,a,s,u);return!0}function Okr(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw vt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=Dxe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(qk(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function Ekr(t,e,r){let n=Object.keys(r),o=n.reduce((i,a)=>({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof e.indexes[i]>"u")throw vt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];ti(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:v=!1}=a[d],g=wxe(f,h),_=i_t(s.root,p,g,m,void 0,v);ti(o[i],_.flatMap(({docIDs:S})=>S))}else{let{coordinates:f,inside:p=!0,highPrecision:h=!1}=a[d],m=a_t(s.root,f,p,void 0,h);ti(o[i],m.flatMap(({docIDs:v})=>v))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let h=Dxe(s,{term:p,exact:!0});ti(o[i],Object.values(h).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw vt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?Zbt:Xbt;ti(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=Txe(s,f,!1);break}case"gte":{p=Txe(s,f,!0);break}case"lt":{p=Mxe(s,f,!1);break}case"lte":{p=Mxe(s,f,!0);break}case"eq":{p=Wbt(s,f)??[];break}case"between":{let[h,m]=f;p=Ubt(s,h,m);break}}ti(o[i],p)}}return Uk(Object.values(o))}function Pkr(t){return t.searchableProperties}function Tkr(t){return t.searchablePropertiesWithTypes}function d_t(t){let e=v1(t.e,t.s,t.k);e.d=t.d,e.w=t.w;for(let r of Object.keys(t.c))e.c[r]=d_t(t.c[r]);return e}function Mkr(t){return{numberToDocumentId:new Map(t)}}function Akr(t){return Array.from(t.numberToDocumentId.entries())}function Rkr(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:h,isArray:m}=r[f];switch(h){case"Radix":c[f]={type:"Radix",node:d_t(p),isArray:m};break;case"Flat":c[f]={type:"Flat",node:Mkr(p),isArray:m};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let h in p)p[h]=[p[h][0],new Float32Array(p[h][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function Ikr(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:h}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:Akr(p),isArray:h}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function f_t(){return{create:c_t,insert:Skr,remove:Ckr,insertDocumentScoreParameters:gkr,insertTokenScoreParameters:ykr,removeDocumentScoreParameters:bkr,removeTokenScoreParameters:_kr,calculateResultScores:vkr,search:Okr,searchByWhereClause:Ekr,getSearchableProperties:Pkr,getSearchablePropertiesWithTypes:Tkr,load:Rkr,save:Ikr}}function p_t(t,e,r,n,o){let i={language:t.tokenizer.language,sharedInternalDocumentStore:e,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[a,s]of Object.entries(r)){let u=`${o}${o?".":""}${a}`;if(!n.includes(u)){if(typeof s=="object"&&!Array.isArray(s)){let l=p_t(t,e,s,n,u);ti(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!yC(s))switch(s){case"boolean":case"number":case"string":i.sortableProperties.push(u),i.sortablePropertiesWithTypes[u]=s,i.sorts[u]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case"geopoint":case"enum":continue;case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw vt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function jkr(t,e,r,n){return n?.enabled!==!1?p_t(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Nkr(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=$o(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&Lxe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function h_t(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)Bkr(t,r);t.isSorted=!0}function Lkr(t,e,r){return e[1].localeCompare(r[1],Obt(t))}function Fkr(t,e){return t[1]-e[1]}function kkr(t,e){return e[1]?-1:1}function Bkr(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=Lkr.bind(null,t.language);break;case"number":n=Fkr.bind(null);break;case"boolean":n=kkr.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i<o;i++){let a=r.orderedDocs[i][0];r.docs.set(a,i)}}function $kr(t){let e=Object.keys(t.sorts);for(let r of e)Lxe(t,r)}function Lxe(t,e){let r=t.sorts[e];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(n=>!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function qkr(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=$o(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function Ukr(t,e,r){if(!t.enabled)throw vt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw vt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return Lxe(t,n),h_t(t),e.sort((a,s)=>{let u=i.docs.get($o(t.sharedInternalDocumentStore,a[0])),l=i.docs.get($o(t.sharedInternalDocumentStore,s[0])),c=typeof u<"u",d=typeof l<"u";return!c&&!d?0:c?d?o?l-u:u-l:-1:1}),e}function zkr(t){return t.enabled?t.sortableProperties:[]}function Hkr(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function Vkr(t,e){let r=e;if(!r.enabled)return{enabled:!1};let n=Object.keys(r.sorts).reduce((o,i)=>{let{docs:a,orderedDocs:s,type:u}=r.sorts[i];return o[i]={docs:new Map(Object.entries(a).map(([l,c])=>[+l,c])),orderedDocsToRemove:new Map,orderedDocs:s,type:u},o},{});return{sharedInternalDocumentStore:t,language:r.language,sortableProperties:r.sortableProperties,sortablePropertiesWithTypes:r.sortablePropertiesWithTypes,sorts:n,enabled:!0,isSorted:r.isSorted}}function Wkr(t){if(!t.enabled)return{enabled:!1};$kr(t),h_t(t);let e=Object.keys(t.sorts).reduce((r,n)=>{let{docs:o,orderedDocs:i,type:a}=t.sorts[n];return r[n]={docs:Object.fromEntries(o.entries()),orderedDocs:i,type:a},r},{});return{language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:e,enabled:t.enabled,isSorted:t.isSorted}}function m_t(){return{create:jkr,insert:Nkr,remove:qkr,save:Wkr,load:Vkr,sortBy:Ukr,getSortableProperties:zkr,getSortablePropertiesWithTypes:Hkr}}var Gkr=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function Kkr(t){return t<192||t>383?t:Gkr[t-192]||t}function g_t(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Kkr(t.charCodeAt(r));return String.fromCharCode(...e)}var Ykr={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},Xkr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Zkr="[^aeiou]",aQ="[aeiouy]",oS=Zkr+"[^aeiouy]*",F3=aQ+"[aeiou]*",Fxe="^("+oS+")?"+F3+oS,Qkr="^("+oS+")?"+F3+oS+"("+F3+")?$",iQ="^("+oS+")?"+F3+oS+F3+oS,y_t="^("+oS+")?"+aQ;function b_t(t){let e,r,n,o,i,a;if(t.length<3)return t;let s=t.substring(0,1);if(s=="y"&&(t=s.toUpperCase()+t.substring(1)),n=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,n.test(t)?t=t.replace(n,"$1$2"):o.test(t)&&(t=t.replace(o,"$1$2")),n=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,n.test(t)){let u=n.exec(t);n=new RegExp(Fxe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(y_t),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+oS+aQ+"[^aeiouwxy]$"),o.test(t)?t=t+"e":i.test(t)?(n=/.$/,t=t.replace(n,"")):a.test(t)&&(t=t+"e")));if(n=/^(.+?)y$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(y_t),e&&n.test(e)&&(t=e+"i")),n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(Fxe),e&&n.test(e)&&(t=e+Ykr[r])}if(n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(Fxe),e&&n.test(e)&&(t=e+Xkr[r])}if(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,o=/^(.+?)(s|t)(ion)$/,n.test(t))e=n.exec(t)?.[1],n=new RegExp(iQ),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(iQ),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(iQ),o=new RegExp(Qkr),i=new RegExp("^"+oS+aQ+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(iQ),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}function kxe(t,e){let r=`${this.language}:${t}:${e}`;return this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(e)?(this.normalizationCache.set(r,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(t)&&(e=this.stemmer(e)),e=g_t(e),this.normalizationCache.set(r,e),e)}function eBr(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function __t(t,e,r){if(e&&e!==this.language)throw vt("LANGUAGE_NOT_SUPPORTED",e);if(typeof t!="string")return[t];let n;if(r&&this.tokenizeSkipProperties.has(r))n=[this.normalizeToken.bind(this,r??"")(t)];else{let i=Cbt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=eBr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function Bxe(t={}){if(!t.language)t.language="english";else if(!j3.includes(t.language))throw vt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw vt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=b_t;else throw vt("MISSING_STEMMER",t.language);let r;if(t.stopWords!==!1){if(r=[],Array.isArray(t.stopWords))r=t.stopWords;else if(typeof t.stopWords=="function")r=t.stopWords(r);else if(t.stopWords)throw vt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw vt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw vt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:__t,language:t.language,stemmer:e,stemmerSkipProperties:new Set(t.stemmerSkipProperties?[t.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(t.tokenizeSkipProperties?[t.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:Boolean(t.allowDuplicates),normalizeToken:kxe,normalizationCache:new Map};return n.tokenize=__t.bind(n),n.normalizeToken=kxe,n}function rBr(t){let e={formatElapsedTime:Ibt,getDocumentIndexId:Dbt,getDocumentProperties:eQ,validateSchema:Sxe};for(let r of Oxe){let n=r;if(t[n]){if(typeof t[n]!="function")throw vt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!Bbt.includes(r)&&!Oxe.includes(r))throw vt("UNSUPPORTED_COMPONENT",r)}function Gk({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=N3());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=Bxe(a):a=Bxe({language:r??"english"}),n.tokenizer&&r)throw vt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=Nbt();s||(s=f_t()),l||(l=m_t()),u||(u=Lbt()),rBr(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:h}=n,m={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:h,id:o,plugins:i,version:nBr()};m.data={index:m.index.create(m,c,t),docs:m.documentsStore.create(m,c),sorting:m.sorter.create(m,c,t,e)};for(let g of Fbt)m[g]=(m[g]??[]).concat(kbt(m,g));let v=m.afterCreate;return v&&$bt(v,m),m}function nBr(){return"{{VERSION}}"}var sQ="fulltext",$xe="hybrid",qxe="vector";var sT=Symbol("orama.insertions"),uT=Symbol("orama.removals");var v_t=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)};function Uxe(t){typeof t[sT]!="number"&&(queueMicrotask(()=>{t[sT]=void 0}),t[sT]=0),t[sT]>1e3?(v_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"}),t[sT]=-1):t[sT]>=0&&t[sT]++}function zxe(t){typeof t[uT]!="number"&&(queueMicrotask(()=>{t[uT]=void 0}),t[uT]=0),t[uT]>1e3?(v_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"}),t[uT]=-1):t[uT]>=0&&t[uT]++}function k3(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw vt("SCHEMA_VALIDATION_FAILURE",i);return Cs(t.index.beforeInsert)||Cs(t.index.insert)||Cs(t.index.afterInsert)?sBr(t,e,r,n,o):uBr(t,e,r,n,o)}var iBr=new Set(["enum","enum[]"]),aBr=new Set(["string","number"]);async function sBr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw vt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw vt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await qg(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let h=typeof p,m=c[f];w_t(h,m,f,p)}return await lBr(t,s,l,d,u,r,e,o),n||await qg(t.afterInsert,t,s,e),Uxe(t),s}function uBr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw vt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw vt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||qg(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let h=typeof p,m=c[f];w_t(h,m,f,p)}return cBr(t,s,l,d,u,r,e,o),n||qg(t.afterInsert,t,s,e),Uxe(t),s}function w_t(t,e,r,n){if(!(jbt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(yC(e)&&Array.isArray(n))&&!(Hk(e)&&Array.isArray(n))&&!(iBr.has(e)&&aBr.has(t))&&t!==e)throw vt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function lBr(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];await t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),await t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),await t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}function cBr(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}function w1(t,e,r,n){return Cs(t.index.beforeRemove)||Cs(t.index.remove)||Cs(t.index.afterRemove)?dBr(t,e,r,n):fBr(t,e,r,n)}async function dBr(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=Jh(t.internalDocumentIDStore,$o(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await qg(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let v=f[m];if(typeof v>"u")continue;let g=d[m];await t.index.beforeRemove?.(t.data.index,m,u,v,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,m,e,v,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,m,u,v,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),h=await t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||await qg(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),zxe(t),o}function fBr(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=Jh(t.internalDocumentIDStore,$o(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||qg(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let v=f[m];if(typeof v>"u")continue;let g=d[m];t.index.beforeRemove?.(t.data.index,m,u,v,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,m,e,v,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,m,u,v,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),h=t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||qg(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),zxe(t),o}function B3(t,e,r,n,o){return Cs(t.index.beforeRemove)||Cs(t.index.remove)||Cs(t.index.afterRemove)||Cs(t.beforeRemoveMultiple)||Cs(t.afterRemoveMultiple)?pBr(t,e,r,n,o):hBr(t,e,r,n,o)}async function pBr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>Jh(t.internalDocumentIDStore,$o(t.internalDocumentIDStore,s)));return o||await _1(t.beforeRemoveMultiple,t,a),await new Promise((s,u)=>{let l=0;async function c(){let d=e.slice(l*r,++l*r);if(!d.length)return s();for(let f of d)try{await w1(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await _1(t.afterRemoveMultiple,t,a),i}function hBr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>Jh(t.internalDocumentIDStore,$o(t.internalDocumentIDStore,l)));o||_1(t.beforeRemoveMultiple,t,a);let s=0;function u(){let l=e.slice(s*r,++s*r);if(l.length){for(let c of l)w1(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||_1(t.afterRemoveMultiple,t,a),i}function mBr(t,e){return t[1]-e[1]}function gBr(t,e){return e[1]-t[1]}function yBr(t="desc"){return t.toLowerCase()==="asc"?mBr:gBr}function Kk(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let h=0;h<f;h++){let m=d[h];p[h]=[`${m.from}-${m.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?zk(c,d):c[d],p=s[d],h=n[d].values;switch(p){case"number":{let m=r[d].ranges;S_t(m,h)(f);break}case"number[]":{let m=new Set,v=r[d].ranges,g=S_t(v,h,m);for(let _ of f)g(_);break}case"boolean":case"enum":case"string":{x_t(h,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=x_t(h,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)g(_);break}default:throw vt("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=yBr(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function S_t(t,e,r){return n=>{for(let o of t){let i=`${o.from}-${o.to}`;r?.has(i)||n>=o.from&&n<=o.to&&(e[i]===void 0?e[i]=1:(e[i]++,r?.add(i)))}}}function x_t(t,e,r){let n=e==="boolean"?"false":"";return o=>{let i=o?.toString()??n;r?.has(i)||(t[i]=(t[i]??0)+1,r?.add(i))}}function Yk(t,e){let r=new Map,n=[];for(let o of t)r.set(o,!0);for(let o of e){let[i]=o;r.has(i)&&(n.push(o),r.delete(i))}return n}var bBr={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},C_t=["string","number","boolean"];function Xk(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g<o;g++){let _=n[g];if(typeof i[_]>"u")throw vt("UNKNOWN_GROUP_BY_PROPERTY",_);if(!C_t.includes(i[_]))throw vt("INVALID_GROUP_BY_PROPERTY",_,C_t.join(", "),i[_])}let a=e.map(([g])=>Jh(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g<o;g++){let _=n[g],S={property:_,perValue:{}},x=new Set;for(let O=0;O<u;O++){let T=s[O],E=zk(T,_);if(typeof E>"u")continue;let M=typeof E!="boolean"?E:""+E,R=S.perValue[M]??{indexes:[],count:0};R.count>=l||(R.indexes.push(O),R.count++,S.perValue[M]=R,x.add(E))}c.push(Array.from(x)),d[_]=S}let f=O_t(c),p=f.length,h=[];for(let g=0;g<p;g++){let _=f[g],S=_.length,x={values:[],indexes:[]},O=[];for(let T=0;T<S;T++){let E=_[T],M=n[T];O.push(d[M].perValue[typeof E!="boolean"?E:""+E].indexes),x.values.push(E)}x.indexes=Uk(O).sort((T,E)=>T-E),x.indexes.length!==0&&h.push(x)}let m=h.length,v=Array.from({length:m});for(let g=0;g<m;g++){let _=h[g],S=r.reduce||bBr,x=_.indexes.map(M=>({id:a[M],score:e[M][1],document:s[M]})),O=S.reducer.bind(null,_.values),T=S.getInitialValue(_.indexes.length),E=x.reduce(O,T);v[g]={values:_.values,result:E}}return v}function O_t(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=O_t(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];ti(s,a),o.push(s)}return o}function E_t(t,e,r){let n=$g(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(uQ,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:h,includeVectors:m=!1}=e,v=e.preflight===!0,{index:g,docs:_}=t.data,S=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let k=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter(F=>k[F].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let k of f)if(!x.includes(k))throw vt("UNKNOWN_INDEX",k,x.join(", "));x=x.filter(k=>f.includes(k))}let O=S1(t.tokenizer,t.index,t.documentsStore,r,e,x,S,t.documentsStore.count(_),n),T=Object.keys(e.where??{}).length>0,E=[];T&&(E=t.index.searchByWhereClause(O,g,e.where));let M=S.length;if(M||f?.length){let k=x.length;for(let F=0;F<k;F++){let L=x[F],q=O.indexMap[L];if(M!==0)for(let I=0;I<M;I++){let H=S[I],W=t.index.search(O,g,L,H);ti(q[H],W)}else{q[""]=[];let I=t.index.search(O,g,L,"");ti(q[""],I)}let U=Object.values(q);O.docsIntersection[L]=nQ(U,e?.boost?.[L]??1,p,M);let G=O.docsIntersection[L],V=G.length;for(let I=0;I<V;I++){let[H,W]=G[I],J=O.uniqueDocsIDs[H];J?O.uniqueDocsIDs[H]=J+W+.5:O.uniqueDocsIDs[H]=W}}}else S.length===0&&d?O.uniqueDocsIDs={}:O.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(k=>[k,0]));let R=Object.entries(O.uniqueDocsIDs).map(([k,F])=>[+k,F]);if(T&&(R=Yk(E,R)),e.sortBy)if(typeof e.sortBy=="function"){let k=R.map(([q])=>q),L=t.documentsStore.getMultiple(t.data.docs,k).map((q,U)=>[R[U][0],R[U][1],q]);L.sort(e.sortBy),R=L.map(([q,U])=>[q,U])}else R=t.sorter.sortBy(t.data.sorting,R,e.sortBy).map(([k,F])=>[$o(t.internalDocumentIDStore,k),F]);else R=R.sort(Rbt);let N;v||(N=h?P_t(t,R,c,l,h):lQ(t,R,c,l));let j={elapsed:{formatted:"",raw:0},hits:[],count:R.length};if(typeof N<"u"&&(j.hits=N.filter(Boolean),m||tQ(j,s)),u){let k=Kk(t,R,e.facets);j.facets=k}return e.groupBy&&(j.groups=Xk(t,R,e.groupBy)),j.elapsed=t.formatElapsedTime($g()-O.timeStart),j}async function a(){t.beforeSearch&&await Wk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Vk(t.afterSearch,t,e,r,s),s}return o?a():i()}function Hxe(t,e,r="english"){let n=$g(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw vt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,h=e.facets&&Object.keys(e.facets).length>0,m=Object.keys(e.where??{}).length>0,{index:v,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?vt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):vt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=oQ(s.value,p,f,e.similarity).map(([k,F])=>[$o(t.internalDocumentIDStore,k),F]),S=t.caches.propertiesToSearch;if(!S){let k=t.index.getSearchablePropertiesWithTypes(v);S=t.index.getSearchableProperties(v),S=S.filter(F=>k[F].startsWith("string")),t.caches.propertiesToSearch=S}let x=[],O=S1(t.tokenizer,t.index,t.documentsStore,r,e,S,x,t.documentsStore.count(g),n),T=[];m&&(T=t.index.searchByWhereClause(O,v,e.where),_=Yk(T,_));let E=[];h&&(E=Kk(t,_,e.facets));let M=Array.from({length:u});for(let k=0;k<u;k++){let F=_[k+l];if(!F)break;let L=t.data.docs.docs[F[0]];if(L){c||(L[s.property]=null);let q={id:Jh(t.internalDocumentIDStore,F[0]),score:F[1],document:L};M[k]=q}}let R=[];e.groupBy&&(R=Xk(t,_,e.groupBy));let j=$g()-n;return{count:_.length,hits:M.filter(Boolean),elapsed:{raw:Number(j),formatted:b1(j)},...E?{facets:E}:{},...R?{groups:R}:{}}}async function a(){t.beforeSearch&&await Wk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Vk(t.afterSearch,t,e,r,s),s}return o?a():i()}function M_t(t,e,r){let n=$g(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{offset:s=0,limit:u=10,includeVectors:l=!1}=e,c=e.facets&&Object.keys(e.facets).length>0,d=_Br(t,e,r),f=vBr(t,e),{index:p,docs:h}=t.data,m=e.hybridWeights,v=SBr(d,f,e.term??"",m),g=t.tokenizer.tokenize(e.term??"",r),_=t.caches.propertiesToSearch;if(!_){let j=t.index.getSearchablePropertiesWithTypes(p);_=t.index.getSearchableProperties(p),_=_.filter(k=>j[k].startsWith("string")),t.caches.propertiesToSearch=_}if(e.properties&&e.properties!=="*"){for(let j of e.properties)if(!_.includes(j))throw vt("UNKNOWN_INDEX",j,_.join(", "));_=_.filter(j=>e.properties.includes(j))}let S=S1(t.tokenizer,t.index,t.documentsStore,r,e,_,g,t.documentsStore.count(h),n),x=Object.keys(e.where??{}).length>0,O=[];x&&(O=t.index.searchByWhereClause(S,p,e.where),v=Yk(O,v));let T;c&&(T=Kk(t,v,e.facets));let E;e.groupBy&&(E=Xk(t,v,e.groupBy));let M=lQ(t,v,s,u).filter(Boolean),R=$g(),N={count:v.length,elapsed:{raw:Number(R-n),formatted:b1(R-n)},hits:M,...T?{facets:T}:{},...E?{groups:E}:{}};if(!l){let j=Object.keys(t.data.index.vectorIndexes);tQ(N,j)}return N}async function a(){t.beforeSearch&&await Wk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Vk(t.afterSearch,t,e,r,s),s}return o?a():i()}function _Br(t,e,r){let n=$g();e.relevance=Object.assign(uQ,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let h=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(m=>h[m].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let h=new Set(c),m=new Set(i);for(let v of i)if(!h.has(v))throw vt("UNKNOWN_INDEX",v,c.join(", "));c=c.filter(v=>m.has(v))}let d=S1(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let h=c.length;for(let m=0;m<h;m++){let v=c[m];if(f!==0)for(let O=0;O<f;O++){let T=l[O],E=t.index.search(d,s,v,T);ti(d.indexMap[v][T],E)}else{let O=[];d.indexMap[v][""]=O;let T=t.index.search(d,s,v,"");ti(O,T)}let g=d.indexMap[v],_=Object.values(g);d.docsIntersection[v]=nQ(_,e?.boost?.[v]??1,a,f);let S=d.docsIntersection[v],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(t.documentsStore.getAll(t.data.docs)).map(h=>[h,0]));let p=Object.entries(d.uniqueDocsIDs).map(([h,m])=>[+h,m]).sort((h,m)=>m[1]-h[1]);return A_t(p)}function vBr(t,e){let r=e.vector,n=t.data.index.vectorIndexes[r?.property],o=n.size,i=n.vectors;if(r&&(!r.value||!r.property))throw vt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw vt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=oQ(r.value,i,o,e.similarity).map(([s,u])=>[$o(t.internalDocumentIDStore,s),u]);return A_t(a)}function Vxe([,t]){return t}function A_t(t){let e=Math.max.apply(Math,t.map(Vxe));return t.map(([r,n])=>[r,n/e])}function T_t(t,e){return t/e}function wBr(t,e){return(r,n)=>r*t+n*e}function SBr(t,e,r,n){let o=Math.max.apply(Math,t.map(Vxe)),i=Math.max.apply(Math,e.map(Vxe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:xBr(r),l=new Map,c=t.length,d=wBr(s,u);for(let p=0;p<c;p++){let[h,m]=t[p],v=T_t(m,o),g=d(v,0);l.set(h,g)}let f=e.length;for(let p=0;p<f;p++){let[h,m]=e[p],v=T_t(m,i),g=l.get(h)??0;l.set(h,g+d(0,v))}return[...l].sort((p,h)=>h[1]-p[1])}function xBr(t){return{text:.5,vector:.5}}var uQ={k:1.2,b:.75,d:.5};function S1(t,e,r,n,o,i,a,s,u){let l={},c={};for(let d of i){let f={};for(let p of a)f[p]=[];l[d]=f,c[d]=[]}return{timeStart:u,tokenizer:t,index:e,documentsStore:r,language:n,params:o,docsCount:s,uniqueDocsIDs:{},indexMap:l,docsIntersection:c}}function gc(t,e,r){let n=e.mode??sQ;if(n===sQ)return E_t(t,e,r);if(n===qxe)return Hxe(t,e);if(n===$xe)return M_t(t,e);throw vt("INVALID_SEARCH_MODE",n)}function P_t(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,h]=f;if(u.has(p))continue;let m=t.documentsStore.get(i,p),v=zk(m,o);if(!(typeof v>"u"||a.has(v))&&(a.set(v,!0),c++,!(c<=r)&&(s.push({id:Jh(t.internalDocumentIDStore,p),score:h,document:m}),u.add(p),c>=r+n)))break}return s}function lQ(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s<n+r;s++){let u=e[s];if(typeof u>"u")break;let[l,c]=u;if(!a.has(l)){let d=t.documentsStore.get(o,l);i[s]={id:Jh(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}function cQ(t,e){t.internalDocumentIDStore.load(t,e.internalDocumentIDStore),t.data.index=t.index.load(t.internalDocumentIDStore,e.index),t.data.docs=t.documentsStore.load(t.internalDocumentIDStore,e.docs),t.data.sorting=t.sorter.load(t.internalDocumentIDStore,e.sorting),t.tokenizer.language=e.language}function Wxe(t){return{internalDocumentIDStore:t.internalDocumentIDStore.save(t.internalDocumentIDStore),index:t.index.save(t.data.index),docs:t.documentsStore.save(t.data.docs),sorting:t.sorter.save(t.data.sorting),language:t.tokenizer.language}}var zvt=B(KQ()),iS=require("obsidian");var Kxe="copilot-index-chunk-",OBr=".json",YQ=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${Kxe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${Kxe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${OBr}`}assignDocumentToPartition(e,r){let o=Array.from(e).reduce((i,a)=>(i<<5)-i+a.charCodeAt(0),0);return Math.abs(o)%r}distributeDocumentsToPartitions(e,r){let n=new Map,o={};for(let a=0;a<r;a++)n.set(a,[]);me().debug&&console.log(`Total documents to distribute: ${e.length}`);for(let a of e){let s=this.assignDocumentToPartition(a.id,r),u=n.get(s);if(!u)throw new Error(`Invalid partition index: ${s}`);u.push(a),o[a.id]=s}let i=0;return n.forEach((a,s)=>{i+=a.length,me().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),me().debug&&(console.log(`Total documents distributed: ${i}`),i!==e.length&&console.error(`Document count mismatch! Original: ${e.length}, Distributed: ${i}`)),n}async ensureDirectoryExists(e){let r=e.substring(0,e.lastIndexOf("/"));await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.mkdir(r)}async saveDatabase(e){try{let r=await Wxe(e),n=me().numPartitions;if(n===1){let l=this.getLegacyPath();await this.ensureDirectoryExists(l),await this.app.vault.adapter.write(l,JSON.stringify({...r,schema:e.schema}));return}let o=r.docs?.docs,i=Array.isArray(o)?o:Object.values(o||{});if(me().debug&&console.log(`Starting save with ${i.length??0} total documents`),!i||i.length===0){let l={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:{}},c=this.getMetadataPath();await this.ensureDirectoryExists(c),await this.app.vault.adapter.write(c,JSON.stringify(l)),me().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([h])=>c.some(m=>m.id===h)))}}},docs:{docs:Object.fromEntries(c.map((h,m)=>[(m+1).toString(),h])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),me().debug&&console.log(`Saved partition ${l+1}/${n}`)}me().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new ir(`Failed to save database: ${r.message}`)}}async loadDatabase(){try{let e=this.getLegacyPath();if(await this.app.vault.adapter.exists(e)){let u=JSON.parse(await this.app.vault.adapter.read(e));if(!u?.schema)throw new ir("Invalid legacy database format");let l=await Gk({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await cQ(l,u),l}let r=await this.loadMetadata(),n=await Gk({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 ir("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++):me().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 cQ(n,o),n}catch(e){throw console.error("Error loading database:",e),new ir(`Failed to load database: ${e.message}`)}}async clearStorage(){try{let e=this.getLegacyPath();await this.app.vault.adapter.exists(e)&&await this.app.vault.adapter.remove(e);let r=await this.app.vault.adapter.list(this.baseDir);for(let n of r.files)n.startsWith(`${this.baseDir}/${Kxe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new ir(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(me().numPartitions===1)return await this.app.vault.adapter.exists(e);let r=this.getMetadataPath();return await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.exists(e)}async loadMetadata(){let e=this.getMetadataPath();if(!await this.app.vault.adapter.exists(e))throw new ir("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new ir("Invalid metadata file: missing schema");return r}async saveMetadata(e){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(e))}};var Yxe=require("obsidian");async function $vt(t){if(!t)throw new ir("Embedding instance not found.");try{let e="Sample text for embedding",r=await t.embedQuery(e);if(!r||r.length===0)throw new ir("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${vo.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new ir("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function qvt(t){let e="",{inclusions:r,exclusions:n}=U3(),o=t.vault.getMarkdownFiles().filter(i=>Zk(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function dT(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function EBr(){return me().qaExclusions?dT(me().qaExclusions):[]}function PBr(){return me().qaInclusions?dT(me().qaInclusions):[]}function U3(){let t=PBr(),e=EBr();return{inclusions:t.length>0?q3(t):null,exclusions:e.length>0?q3(e):null}}function Zk(t,e,r){return!(r&&Bvt(t.path,r)||e&&!Bvt(t.path,e))}function q3(t){let e=[],r=[],n=[],o=[],i=/^#[^\s#]+$/,a=/^\*\.([a-zA-Z0-9.]+)$/,s=/^\[\[(.*?)\]\]$/;return t.forEach(u=>{i.test(u)?e.push(u):a.test(u)?r.push(u):s.test(u)?o.push(u):n.push(u)}),{tagPatterns:e,extensionPatterns:r,folderPatterns:n,notePatterns:o}}function Uvt({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function TBr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof Yxe.TFile){let n=uU(r);if(e.some(o=>n.includes(Wj(o))))return!0}return!1}function MBr(t,e){if(e.length===0)return!1;let r=t.split(".").pop()?.toLowerCase()||"";return e.some(n=>n.slice(2)===r)}function ABr(t,e){if(e.length===0)return!1;let r=t.replace(/\\/g,"/");return e.some(n=>{let o=n.replace(/\\/g,"/").replace(/\/$/,"");return r.startsWith(o)&&(r.length===o.length||r[o.length]==="/")})}function RBr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof Yxe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function Bvt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return TBr(t,r??[])||MBr(t,n??[])||ABr(t,o??[])||RBr(t,i??[])}function XQ(t){let e=[];try{let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}var Wd=class{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;bl(async()=>{let r=me();iS.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):iS.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await vo.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(hr("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await vo.getInstance().getEmbeddingsAPI()),hr("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new ir("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new YQ(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),iS.Platform.isMobile&&me().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new ir("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),hr("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){Mo("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){Mo("Error initializing Orama database:",r),new iS.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(iS.Platform.isMobile&&me().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await vo.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new ir("Orama database not found.")}catch(e){throw Mo("Failed to initialize database during save:",e),new ir("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,me().debug&&hr("Orama database saved successfully at:",this.dbPath)}catch(e){throw Mo("Error saving Orama database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new iS.Notice("Local Copilot index cleared successfully."),hr("Local Copilot index cleared successfully, new instance created.")}catch(r){throw Mo("Error clearing the local Copilot index:",r),new iS.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new ir("Orama database not found.");try{let r=await gc(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await B3(this.oramaDb,r.hits.map(n=>n.id),500),me().debug&&hr(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){Mo("Error deleting document from local Copilotindex:",r)}}getDb(){return this.oramaDb||console.warn("Database not initialized. Some features may be limited."),this.oramaDb}async getIsIndexLoaded(){return this.isIndexLoaded}async waitForInitialization(){await this.initializationPromise}onunload(){this.hasUnsavedChanges&&this.saveDB()}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,r;if(me().enableIndexSync)r=this.app.vault.configDir;else{let n=e==="/"?"":e;r=`${n===""||n.startsWith("/")?"":"/"}${n}/.copilot-index`,await this.app.vault.adapter.exists(r)||(await this.app.vault.adapter.mkdir(r),hr("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,zvt.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new ir("Embedding instance not found.");let r=await $vt(e);if(!r||r===0)throw new ir("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await Gk({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return hr(`Created new Orama database for ${this.dbPath}. Embedding model: ${vo.getModelName(e)} with vector length ${r}.`),this.isIndexLoaded=!0,o}static async getDocsByPath(e,r){if(!e)throw new Error("DB not initialized");return r?(await gc(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await gc(e,{mode:"vector",vector:{value:r,property:"embedding"},limit:n.limit,similarity:n.similarity,includeVectors:!0})).hits}static async getLatestFileMtime(e){if(!e)throw new Error("DB not initialized");try{let r=await gc(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return Mo("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(e){if(!this.oramaDb)throw new Error("DB not initialized");try{let r=this.chunkedStorage?.assignDocumentToPartition(e.id,me().numPartitions),n=await gc(this.oramaDb,{term:e.id,properties:["id"],limit:1});n.hits.length>0&&await w1(this.oramaDb,n.hits[0].id);try{return await k3(this.oramaDb,e),hr(`${n.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${r}`),this.markUnsavedChanges(),e}catch(o){if(Mo(`Failed to ${n.hits.length>0?"update":"insert"} document ${e.id}:`,o),n.hits.length>0)try{await k3(this.oramaDb,n.hits[0].document)}catch(i){Mo("Failed to restore previous document version:",i)}return}}catch(r){Mo(`Error upserting document ${e.id}:`,r);return}}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await gc(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return Mo("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){hr("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw Mo("Failed to initialize database:",o),new ir("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await gc(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=vo.getModelName(e);if(!mke(n,o))return new iS.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),hr("Detected change in embedding model. Rebuilding Copilot index from scratch."),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else hr("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await gc(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){hr("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await vo.getInstance().getEmbeddingsAPI();if(!e)throw new ir("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new ir("Failed to initialize database after attempt.")}catch(e){throw Mo("Failed to initialize database during garbage collection:",e),new ir("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(i=>i.path)),o=(await Wd.getAllDocuments(this.oramaDb)).filter(i=>!r.has(i.path));return o.length===0?0:(hr("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await w1(this.oramaDb,o[0].id):await B3(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw Mo("Error garbage collecting the Copilot index:",e),new ir("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new ir("Orama database not found.");try{let e=await Wd.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw Mo("Error getting indexed files:",e),new ir("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await gc(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw Mo("Error checking if database is empty:",e),new ir("Failed to check if database is empty.")}}async hasIndex(e){if(!this.oramaDb)return!1;let r=await Wd.getDocsByPath(this.oramaDb,e);return r!==void 0&&r.length>0}async hasEmbeddings(e){if(!this.oramaDb)return!1;let r=await Wd.getDocsByPath(this.oramaDb,e);return!r||r.length===0?!1:r.every(n=>n?.document?.embedding&&Array.isArray(n.document.embedding)&&n.document.embedding.length>0)}async getDocsJsonByPaths(e){if(!this.oramaDb)throw new ir("Orama database not found.");let r={};for(let n of e){let o=await Wd.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new ir("Orama database not found.");try{let e=await this.getIndexedFiles();for(let n of e)await this.hasEmbeddings(n)||this.markFileMissingEmbeddings(n);let r=this.getFilesMissingEmbeddings();r.length>0?hr("Files missing embeddings after integrity check:",r.join(", ")):hr("Index integrity check completed. All documents have embeddings.")}catch(e){throw Mo("Error checking index integrity:",e),new ir("Failed to check index integrity.")}}};var z3=require("obsidian");var IBr=1e4,ZQ=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.handleFileModify=async e=>{if(z3.Platform.isMobile&&me().disableIndexOnMobile)return;let r=eg();if(e instanceof z3.TFile&&e.extension==="md"&&r==="copilot_plus"){let{inclusions:n,exclusions:o}=U3();Zk(e,n,o)&&this.debouncedReindexFile(e)}};this.debouncedReindexFile=e=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{me().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},IBr)};this.handleFileDelete=async e=>{e instanceof z3.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){me().debug&&console.log("Copilot Plus: Initializing event listeners"),this.app.vault.on("modify",this.handleFileModify),this.app.vault.on("delete",this.handleFileDelete)}cleanup(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.app.vault.off("modify",this.handleFileModify),this.app.vault.off("delete",this.handleFileDelete)}};var H3=class{constructor(e){this.lastRequestTime=0;this.requestsPerMin=e}setRequestsPerMin(e){this.requestsPerMin=e}getRequestsPerMin(){return this.requestsPerMin}async wait(){let r=Date.now()-this.lastRequestTime,n=Math.max(0,6e4/this.requestsPerMin-r);n>0&&await new Promise(o=>setTimeout(o,n)),this.lastRequestTime=Date.now()}};var Vvt=B(KQ());Hvt();hf();var QQ=class extends nn{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","documents","transformers"]})}invoke(e,r){return this.transformDocuments(e)}};sSe();var Xxe=class extends QQ{constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","document_transformers","text_splitters"]}),Object.defineProperty(this,"chunkSize",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"chunkOverlap",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"keepSeparator",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lengthFunction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let h of await this.splitText(c)){let m=i,v=c.indexOf(h,p+1);if(f===null){let x=this.numberOfNewLines(c,0,v);d+=x}else{let x=p+await this.lengthFunction(f);if(x<v){let O=this.numberOfNewLines(c,x,v);d+=O}else if(x>v){let O=this.numberOfNewLines(c,v,x);d-=O}s&&(m+=a)}let g=this.numberOfNewLines(h),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+g};let S={...o[l],loc:_};m+=h,u.push(new _C({pageContent:m,metadata:S})),d+=g,f=h,p=v}}return u}numberOfNewLines(e,r,n){return(e.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(e,r={}){let n=e.filter(a=>a.pageContent!==void 0),o=n.map(a=>a.pageContent),i=n.map(a=>a.metadata);return this.createDocuments(o,i,r)}joinDocs(e,r){let n=e.join(r).trim();return n===""?null:n}async mergeSplits(e,r){let n=[],o=[],i=0;for(let s of e){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}};var x1=class extends Xxe{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(e){super(e),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[`
`,`
`," ",""]}),this.separators=e?.separators??this.separators,this.keepSeparator=e?.keepSeparator??!0}async _splitText(e,r){let n=[],o=r[r.length-1],i;for(let l=0;l<r.length;l+=1){let c=r[l];if(c===""){o=c;break}if(e.includes(c)){o=c,i=r.slice(l+1);break}}let a=this.splitOnSeparator(e,o),s=[],u=this.keepSeparator?"":o;for(let l of a)if(await this.lengthFunction(l)<this.chunkSize)s.push(l);else{if(s.length){let c=await this.mergeSplits(s,u);n.push(...c),s=[]}if(!i)n.push(l);else{let c=await this._splitText(l,i);n.push(...c)}}if(s.length){let l=await this.mergeSplits(s,u);n.push(...l)}return n}async splitText(e){return this._splitText(e,this.separators)}static fromLanguage(e,r){return new x1({...r,separators:x1.getSeparatorsForLanguage(e)})}static getSeparatorsForLanguage(e){if(e==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`
`,`
`," ",""];if(e==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`
`,`
`," ",""];if(e==="python")return[`
class `,`
def `,`
def `,`
`,`
`," ",""];if(e==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`
`,`
`," ",""];if(e==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`
`,`
`," ",""];if(e==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`
`,`
`," ",""];if(e==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`
`,`
`," ",""];if(e==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`
***
`,`
---
`,`
___
`,`
`,`
`," ",""];if(e==="latex")return[`
\\chapter{`,`
\\section{`,`
\\subsection{`,`
\\subsubsection{`,`
\\begin{enumerate}`,`
\\begin{itemize}`,`
\\begin{description}`,`
\\begin{list}`,`
\\begin{quote}`,`
\\begin{quotation}`,`
\\begin{verse}`,`
\\begin{verbatim}`,`
\\begin{align}`,"$$","$",`
`,`
`," ",""];if(e==="html")return["<body>","<div>","<p>","<br>","<li>","<h1>","<h2>","<h3>","<h4>","<h5>","<h6>","<span>","<table>","<tr>","<td>","<th>","<ul>","<ol>","<header>","<footer>","<nav>","<head>","<style>","<script>","<meta>","<title>"," ",""];if(e==="sol")return[`
pragma `,`
using `,`
contract `,`
interface `,`
library `,`
constructor `,`
type `,`
function `,`
event `,`
modifier `,`
error `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do while `,`
assembly `,`
`,`
`," ",""];throw new Error(`Language ${e} is not supported.`)}};var aS=require("obsidian");var eee=class{constructor(e,r,n){this.app=e;this.dbOps=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null};let o=me();this.rateLimiter=new H3(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,bl(async()=>{let i=me();this.rateLimiter=new H3(i.embeddingRequestsPerMin),this.embeddingBatchSize=i.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize})}async indexVaultToVectorStore(e){let r=[];try{let n=await this.embeddingsManager.getEmbeddingsAPI();if(!n)return console.error("Embedding instance not found."),0;await this.dbOps.checkAndHandleEmbeddingModelChange(n)&&(e=!0),e?(await this.dbOps.clearIndex(n),this.dbOps.clearFilesMissingEmbeddings()):await this.dbOps.garbageCollect();let i=await this.getFilesToIndex(e);if(i.length===0)return new aS.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 aS.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));for(let f=0;f<u.length;f++){let p=u[f];try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:l[f],created_at:Date.now(),nchars:p.content.length})}catch(h){throw this.dbOps.markFileMissingEmbeddings(p.fileInfo.path),h}}u.forEach(f=>{this.state.processedFiles.add(f.fileInfo.path)}),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."),this.dbOps.checkIndexIntegrity().catch(s=>{Mo("Background integrity check failed:",s)}),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(e){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=vo.getModelName(r),o=x1.fromLanguage("markdown",{chunkSize:Oke}),i=[];for(let a of e){let s=await this.app.vault.cachedRead(a);if(!s?.trim())continue;let u=this.app.metadataCache.getFileCache(a),l={title:a.basename,path:a.path,embeddingModel:n,ctime:a.stat.ctime,mtime:a.stat.mtime,tags:u?.tags?.map(d=>d.tag)??[],extension:a.extension,metadata:{...u?.frontmatter??{},created:ys(new Date(a.stat.ctime)).display,modified:ys(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:`
NOTE TITLE: [[${l.title}]]
METADATA:${JSON.stringify(l.metadata)}
NOTE BLOCK CONTENT:
`,appendChunkOverlapHeader:!0})).forEach(d=>{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(e){return(0,Vvt.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=U3(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>Zk(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(!Zk(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 hr([`Files to index: ${u.size}`,`Previously indexed: ${i.size}`,`Empty files skipped: ${l.size}`,`Files missing embeddings: ${s.size}`].join(`
`)),Array.from(u)}initializeIndexingState(e){this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:e,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null}}createIndexingNotice(){let e=document.createDocumentFragment(),r=e.createEl("div",{cls:"copilot-notice-container"});this.state.indexNoticeMessage=r.createEl("div",{cls:"copilot-notice-message"}),this.updateIndexingNoticeMessage();let n=r.createEl("div",{cls:"copilot-notice-buttons"}),o=n.createEl("button");o.textContent="Pause",o.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.state.isIndexingPaused?(this.resumeIndexing(),o.textContent="Pause"):(this.pauseIndexing(),o.textContent="Resume")});let i=n.createEl("button");return i.textContent="Stop",i.style.marginLeft="8px",i.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.cancelIndexing()}),e.appendChild(this.state.indexNoticeMessage),e.appendChild(n),this.state.currentIndexingNotice=new aS.Notice(e,0),this.state.currentIndexingNotice}async handlePause(){if(this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;)await new Promise(e=>setTimeout(e,100));if(!this.state.isIndexingCancelled){let e=await this.getFilesToIndex();if(e.length===0){console.log("No files to index after filter change, stopping indexing"),this.cancelIndexing(),new aS.Notice("No files to index with current filters");return}this.state.totalFilesToIndex=e.length,console.log("Total files to index:",this.state.totalFilesToIndex),console.log("Files to index:",e),this.updateIndexingNoticeMessage()}}}pauseIndexing(){this.state.isIndexingPaused=!0}resumeIndexing(){this.state.isIndexingPaused=!1}updateIndexingNoticeMessage(){if(this.state.indexNoticeMessage){let e=this.state.isIndexingPaused?" (Paused)":"",r=["Copilot is indexing your vault...",`${this.state.indexedCount}/${this.state.totalFilesToIndex} files processed${e}`],n=me(),o=dT(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...XQ(this.app),...dT(n.qaExclusions)];a.length>0&&r.push(`Exclusions: ${a.join(", ")}`),this.state.indexNoticeMessage.textContent=r.join(`
`)}}isStringLengthError(e){if(!e)return!1;if(e instanceof RangeError&&e.message.toLowerCase().includes("string length"))return!0;let n=(e.message||e.toString()).toLowerCase();return n.includes("string length")||n.includes("rangeerror")}handleError(e,r){let n=r?.filePath;if(n?(r.batch?console.error("Batch processing error:",{error:e,batchSize:r.batch.length||0,firstChunk:r.batch[0]?{path:r.batch[0].fileInfo?.path,contentLength:r.batch[0].content?.length,hasFileInfo:!!r.batch[0].fileInfo}:"No chunks in batch",errorType:e?.constructor?.name,errorMessage:e?.message}):console.error(`Error indexing file ${n}:`,e),r.errors?.push(n)):console.error("Fatal error during indexing:",e),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.isStringLengthError(e)){new aS.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}if(this.isRateLimitError(e))return;let o=n?`Error indexing file ${n}. Check console for details.`:"Fatal error during indexing. Check console for details.";new aS.Notice(o)}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.state.isIndexingCancelled){new aS.Notice("Indexing cancelled");return}e.length>0?new aS.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new aS.Notice("Indexing completed successfully!")}async reindexFile(e){try{let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return;if(await this.dbOps.removeDocs(e.path),await this.dbOps.checkAndHandleEmbeddingModelChange(r)){await this.indexVaultToVectorStore(!0);return}let o=await this.prepareAllChunks([e]);if(o.length===0)return;let i=await r.embedDocuments(o.map(a=>a.content));for(let a=0;a<o.length;a++){let s=o[a];await this.dbOps.upsert({...s.fileInfo,id:this.getDocHash(s.content),content:s.content,embedding:i[a],created_at:Date.now(),nchars:s.content.length})}this.dbOps.markUnsavedChanges(),me().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){console.log("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,await new Promise(e=>setTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}};var Ki=class{constructor(){this.embeddingsManager=vo.getInstance(),this.dbOps=new Wd(app),this.indexOps=new eee(app,this.dbOps,this.embeddingsManager),this.eventHandler=new ZQ(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return Ki.instance||(Ki.instance=new Ki),Ki.instance}setupSettingsSubscription(){this.lastKnownSettings={...me()};let e=async()=>{let r=me(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync){let o=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==o&&await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI())}};bl(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI());break}catch(r){if(r instanceof ir&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new V3.Notice("Failed to initialize vector store. Please make sure you have a valid API key for your embedding model and restart the plugin."),console.error("Failed to initialize vector store:",r);break}}catch(e){console.error("Failed to initialize vector store:",e)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e){return await this.waitForInitialization(),V3.Platform.isMobile&&me().disableIndexOnMobile?(new V3.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(e)}async clearIndex(){await this.waitForInitialization(),await this.dbOps.clearIndex(await this.embeddingsManager.getEmbeddingsAPI())}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.dbOps.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.dbOps.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),this.dbOps.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.dbOps.hasIndex(e)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let e=this.dbOps.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),await this.indexOps.reindexFile(e)}};var Zxe="copilot-plus-flash",DBr=Zxe+"|"+"copilot-plus",Qxe="copilot-plus-small",eCe=Qxe+"|"+"copilot-plus";function rfe(t){return t.split("|")[1]==="copilot-plus"}function tee(){return Fa().isPlusUser}async function ree(){return me().plusLicenseKey?await Sa.getInstance().validateLicenseKey():(rCe(),!1)}function Wvt(){let t=DBr,e=eCe,r=me().embeddingModelKey;n9(t),Yj("copilot_plus"),cE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e&&Ki.getInstance().indexVaultToVectorStore()}function tCe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function DN(t){window.open(tCe(t),"_blank")}function Jvt(){Ft("isPlusUser",!0)}function rCe(){let t=me().isPlusUser;Ft("isPlusUser",!1),t&&new AW(app).open()}var Gvt=require("obsidian"),Sa=class{constructor(){this.pluginVersion="Unknown"}static getInstance(){return Sa.instance||(Sa.instance=new Sa),Sa.instance}checkLicenseKey(){if(!me().plusLicenseKey)throw new Gvt.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1){this.checkLicenseKey();let i=new URL(`${LA}${e}`);n==="GET"&&Object.entries(r).forEach(([u,l])=>{i.searchParams.append(u,l)});let s=await(await fetch(i.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Qo(me().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}})).json();return hr(`==== ${e} request ====:`,s),s}async validateLicenseKey(){try{return hr("settings value",me().plusLicenseKey),await this.makeRequest("/license",{license_key:await Qo(me().plusLicenseKey)},"POST",!0),Jvt(),!0}catch(e){return H5(e).reason==="Invalid license key"?(hr("validateLicenseKey: false"),rCe(),!1):void 0}}async broca(e){return await this.makeRequest("/broca",{message:e})}async rerank(e,r){return this.makeRequest("/rerank",{query:e,documents:r,model:"rerank-2"})}async url4llm(e){return this.makeRequest("/url4llm",{url:e})}async pdf4llm(e){let r=Buffer.from(e).toString("base64");return this.makeRequest("/pdf4llm",{pdf:r})}async webSearch(e){return this.makeRequest("/websearch",{query:e})}async youtube4llm(e){return this.makeRequest("/youtube4llm",{url:e})}};var fCe={};nf(fCe,{APIConnectionError:()=>wC,APIConnectionTimeoutError:()=>E1,APIError:()=>za,APIUserAbortError:()=>Il,AnthropicError:()=>zr,AuthenticationError:()=>rB,BadRequestError:()=>tB,ConflictError:()=>iB,InternalServerError:()=>uB,NotFoundError:()=>oB,PermissionDeniedError:()=>nB,RateLimitError:()=>sB,UnprocessableEntityError:()=>aB});var C1="0.27.3";var Kvt=!1,O1,nCe,jBr,NBr,LBr,Yvt,FBr,nee,oCe,Xvt,iCe,oee,Zvt;function Qvt(t,e={auto:!1}){if(Kvt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(O1)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${O1}'\``);Kvt=e.auto,O1=t.kind,nCe=t.fetch,jBr=t.Request,NBr=t.Response,LBr=t.Headers,Yvt=t.FormData,FBr=t.Blob,nee=t.File,oCe=t.ReadableStream,Xvt=t.getMultipartRequestOptions,iCe=t.getDefaultAgent,oee=t.fileFromPath,Zvt=t.isFsReadStream}var iee=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function e0t({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from '@anthropic-ai/sdk'`:\n- `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)\n- `import '@anthropic-ai/sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new iee(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}}O1||Qvt(e0t(),{auto:!0});var Jd=class{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of BBr(e,r)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event!=="ping"&&a.event==="error")throw za.generate(void 0,`SSE Error: ${a.data}`,a.data,sCe(e.headers))}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new Jd(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new vC,s=t0t(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new Jd(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new Jd(()=>o(e),this.controller),new Jd(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new oCe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*BBr(t,e){if(!t.body)throw e.abort(),new zr("Attempted to iterate over a response with no body");let r=new aCe,n=new vC,o=t0t(t.body);for await(let i of $Br(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*$Br(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=qBr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function qBr(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var aCe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=UBr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},vC=class{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=vC.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(vC.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new zr(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new zr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new zr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};vC.NEWLINE_CHARS=new Set([`
`,"\r"]);vC.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function UBr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function t0t(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var zBr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",HBr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&W3(t),W3=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function";async function r0t(t,e,r){if(t=await t,HBr(t))return t;if(zBr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=W3(o)?[await o.arrayBuffer()]:[o];return new nee(i,e,r)}let n=await VBr(t);if(e||(e=JBr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new nee(n,e,r)}async function VBr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(W3(t))e.push(await t.arrayBuffer());else if(GBr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${WBr(t)}`);return e}function WBr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function JBr(t){return uCe(t.name)||uCe(t.filename)||uCe(t.path)?.split(/[\\/]/).pop()}var uCe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},GBr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",lCe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var YBr=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},XBr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},aee;async function u0t(t){let{response:e}=t;if(t.options.stream)return Qk("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Jd.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return Qk("response",e.status,e.url,e.headers,i),i}let o=await e.text();return Qk("response",e.status,e.url,e.headers,o),o}var eB=class extends Promise{constructor(e,r=u0t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new eB(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},see=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=cCe("maxRetries",r),this.timeout=cCe("timeout",n),this.httpAgent=o,this.fetch=i??nCe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...e$r(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${a$r()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&W3(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e){let{method:r,path:n,query:o,headers:i={}}=e,a=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:lCe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in e&&cCe("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??iCe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:e.signal??null},url:u,timeout:l}}buildHeaders({options:e,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(e);return s0t(o,i),s0t(o,r),lCe(e.body)&&O1!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return za.generate(e,r,n,o)}request(e,r=null){return new eB(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e;r==null&&(r=n.maxRetries??this.maxRetries),await this.prepareOptions(n);let{req:o,url:i,timeout:a}=this.buildRequest(n);if(await this.prepareRequest(o,{url:i,options:n}),Qk("request",i,n,o.headers),n.signal?.aborted)throw new Il;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(uee);if(u instanceof Error){if(n.signal?.aborted)throw new Il;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new E1:new wC({cause:u})}let l=sCe(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return Qk(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>uee(m).message),d=t$r(c),f=d?void 0:c;throw Qk(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,u.status,i,l,f),this.makeStatusError(u.status,d,f,l)}return{response:u,options:n,controller:s}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new dCe(this,n,e)}buildURL(e,r){let n=n$r(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return cee(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new zr(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n);return this.getRequestClient().fetch.call(void 0,e,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await o$r(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${C1}`}},n0t=class{constructor(e,r,n,o){aee.set(this,void 0),YBr(this,aee,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new zr("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await XBr(this,aee,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(aee=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},dCe=class extends eB{constructor(e,r,n){super(r,async o=>new n(e,o.response,await u0t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},sCe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var ZBr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C1,"X-Stainless-OS":i0t(Deno.build.os),"X-Stainless-Arch":o0t(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":C1,"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":C1,"X-Stainless-OS":i0t(process.platform),"X-Stainless-Arch":o0t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=QBr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function QBr(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var o0t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",i0t=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),a0t,e$r=()=>a0t??(a0t=ZBr()),t$r=t=>{try{return JSON.parse(t)}catch{return}},r$r=new RegExp("^(?:[a-z]+:)?//","i"),n$r=t=>r$r.test(t),o$r=t=>new Promise(e=>setTimeout(e,t)),cCe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new zr(`${t} must be an integer`);if(e<0)throw new zr(`${t} must be a positive integer`);return e},uee=t=>t instanceof Error?t:new Error(t);var lee=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function cee(t){if(!t)return!0;for(let e in t)return!1;return!0}function i$r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function s0t(t,e){for(let r in e){if(!i$r(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function Qk(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var a$r=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),l0t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var zr=class extends Error{},za=class extends zr{constructor(e,r,n,o){super(`${za.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["request-id"],this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new wC({message:n,cause:uee(r)});let i=r;return e===400?new tB(e,i,n,o):e===401?new rB(e,i,n,o):e===403?new nB(e,i,n,o):e===404?new oB(e,i,n,o):e===409?new iB(e,i,n,o):e===422?new aB(e,i,n,o):e===429?new sB(e,i,n,o):e>=500?new uB(e,i,n,o):new za(e,i,n,o)}},Il=class extends za{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},wC=class extends za{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},E1=class extends wC{constructor({message:e}={}){super({message:e??"Request timed out."})}},tB=class extends za{constructor(){super(...arguments),this.status=400}},rB=class extends za{constructor(){super(...arguments),this.status=401}},nB=class extends za{constructor(){super(...arguments),this.status=403}},oB=class extends za{constructor(){super(...arguments),this.status=404}},iB=class extends za{constructor(){super(...arguments),this.status=409}},aB=class extends za{constructor(){super(...arguments),this.status=422}},sB=class extends za{constructor(){super(...arguments),this.status=429}},uB=class extends za{};var Kh=class{constructor(e){this._client=e}};var u$r=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",u=!1;for(n=t[++e];n!=='"';){if(e===t.length){u=!0;break}if(n==="\\"){if(e++,e===t.length){u=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],u||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let i=/[0-9]/;if(n&&i.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&i.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let a=/[a-z]/i;if(n&&a.test(n)){let s="";for(;n&&a.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},lB=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),lB(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),lB(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),lB(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),lB(t);break;case"delimiter":return t=t.slice(0,t.length-1),lB(t);break}return t},l$r=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},c$r=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},dee=t=>JSON.parse(c$r(l$r(lB(u$r(t)))));var $f=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},cn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yh,fT,fee,pee,J3,G3,hee,K3,SC,Y3,mee,gee,cB,pCe,c0t,hCe,mCe,gCe,yCe,d0t,f0t="__json_buf",P1=class{constructor(){Yh.add(this),this.messages=[],this.receivedMessages=[],fT.set(this,void 0),this.controller=new AbortController,fee.set(this,void 0),pee.set(this,()=>{}),J3.set(this,()=>{}),G3.set(this,void 0),hee.set(this,()=>{}),K3.set(this,()=>{}),SC.set(this,{}),Y3.set(this,!1),mee.set(this,!1),gee.set(this,!1),cB.set(this,!1),hCe.set(this,e=>{if($f(this,mee,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Il),e instanceof Il)return $f(this,gee,!0,"f"),this._emit("abort",e);if(e instanceof zr)return this._emit("error",e);if(e instanceof Error){let r=new zr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new zr(String(e)))}),$f(this,fee,new Promise((e,r)=>{$f(this,pee,e,"f"),$f(this,J3,r,"f")}),"f"),$f(this,G3,new Promise((e,r)=>{$f(this,hee,e,"f"),$f(this,K3,r,"f")}),"f"),cn(this,fee,"f").catch(()=>{}),cn(this,G3,"f").catch(()=>{})}static fromReadableStream(e){let r=new P1;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new P1;for(let i of r.messages)o._addPromptCachingBetaMessageParam(i);return o._run(()=>o._createPromptCachingBetaMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},cn(this,hCe,"f"))}_addPromptCachingBetaMessageParam(e){this.messages.push(e)}_addPromptCachingBetaMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createPromptCachingBetaMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),cn(this,Yh,"m",mCe).call(this);let i=await e.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)cn(this,Yh,"m",gCe).call(this,a);if(i.controller.signal?.aborted)throw new Il;cn(this,Yh,"m",yCe).call(this)}_connected(){this.ended||(cn(this,pee,"f").call(this),this._emit("connect"))}get ended(){return cn(this,Y3,"f")}get errored(){return cn(this,mee,"f")}get aborted(){return cn(this,gee,"f")}abort(){this.controller.abort()}on(e,r){return(cn(this,SC,"f")[e]||(cn(this,SC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=cn(this,SC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(cn(this,SC,"f")[e]||(cn(this,SC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{$f(this,cB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){$f(this,cB,!0,"f"),await cn(this,G3,"f")}get currentMessage(){return cn(this,fT,"f")}async finalMessage(){return await this.done(),cn(this,Yh,"m",pCe).call(this)}async finalText(){return await this.done(),cn(this,Yh,"m",c0t).call(this)}_emit(e,...r){if(cn(this,Y3,"f"))return;e==="end"&&($f(this,Y3,!0,"f"),cn(this,hee,"f").call(this));let n=cn(this,SC,"f")[e];if(n&&(cn(this,SC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!cn(this,cB,"f")&&!n?.length&&Promise.reject(o),cn(this,J3,"f").call(this,o),cn(this,K3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!cn(this,cB,"f")&&!n?.length&&Promise.reject(o),cn(this,J3,"f").call(this,o),cn(this,K3,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalPromptCachingBetaMessage",cn(this,Yh,"m",pCe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),cn(this,Yh,"m",mCe).call(this),this._connected();let o=Jd.fromReadableStream(e,this.controller);for await(let i of o)cn(this,Yh,"m",gCe).call(this,i);if(o.controller.signal?.aborted)throw new Il;cn(this,Yh,"m",yCe).call(this)}[(fT=new WeakMap,fee=new WeakMap,pee=new WeakMap,J3=new WeakMap,G3=new WeakMap,hee=new WeakMap,K3=new WeakMap,SC=new WeakMap,Y3=new WeakMap,mee=new WeakMap,gee=new WeakMap,cB=new WeakMap,hCe=new WeakMap,Yh=new WeakSet,pCe=function(){if(this.receivedMessages.length===0)throw new zr("stream ended without producing a PromptCachingBetaMessage with role=assistant");return this.receivedMessages.at(-1)},c0t=function(){if(this.receivedMessages.length===0)throw new zr("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 zr("stream ended without producing a content block with type=text");return r.join(" ")},mCe=function(){this.ended||$f(this,fT,void 0,"f")},gCe=function(r){if(this.ended)return;let n=cn(this,Yh,"m",d0t).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":{$f(this,fT,n,"f");break}case"content_block_start":case"message_delta":break}},yCe=function(){if(this.ended)throw new zr("stream has ended, this shouldn't happen");let r=cn(this,fT,"f");if(!r)throw new zr("request ended without sending any chunks");return $f(this,fT,void 0,"f"),r},d0t=function(r){let n=cn(this,fT,"f");if(r.type==="message_start"){if(n)throw new zr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new zr(`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=dee(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Jd(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var T1=class extends Kh{create(e,r){return this._client.post("/v1/messages?beta=prompt_caching",{body:e,timeout:this._client._options.timeout??6e5,...r,headers:{"anthropic-beta":"prompt-caching-2024-07-31",...r?.headers},stream:e.stream??!1})}stream(e,r){return P1.createMessage(this,e,r)}};(function(t){})(T1||(T1={}));var M1=class extends Kh{constructor(){super(...arguments),this.messages=new T1(this._client)}};(function(t){t.Messages=T1})(M1||(M1={}));var pT=class extends Kh{constructor(){super(...arguments),this.promptCaching=new M1(this._client)}};(function(t){t.PromptCaching=M1})(pT||(pT={}));var hT=class extends Kh{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};(function(t){})(hT||(hT={}));var qf=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},dn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Xh,mT,yee,bee,X3,Z3,_ee,Q3,xC,e8,vee,wee,dB,bCe,p0t,_Ce,vCe,wCe,SCe,h0t,m0t="__json_buf",A1=class{constructor(){Xh.add(this),this.messages=[],this.receivedMessages=[],mT.set(this,void 0),this.controller=new AbortController,yee.set(this,void 0),bee.set(this,()=>{}),X3.set(this,()=>{}),Z3.set(this,void 0),_ee.set(this,()=>{}),Q3.set(this,()=>{}),xC.set(this,{}),e8.set(this,!1),vee.set(this,!1),wee.set(this,!1),dB.set(this,!1),_Ce.set(this,e=>{if(qf(this,vee,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Il),e instanceof Il)return qf(this,wee,!0,"f"),this._emit("abort",e);if(e instanceof zr)return this._emit("error",e);if(e instanceof Error){let r=new zr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new zr(String(e)))}),qf(this,yee,new Promise((e,r)=>{qf(this,bee,e,"f"),qf(this,X3,r,"f")}),"f"),qf(this,Z3,new Promise((e,r)=>{qf(this,_ee,e,"f"),qf(this,Q3,r,"f")}),"f"),dn(this,yee,"f").catch(()=>{}),dn(this,Z3,"f").catch(()=>{})}static fromReadableStream(e){let r=new A1;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new A1;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},dn(this,_Ce,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),dn(this,Xh,"m",vCe).call(this);let i=await e.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)dn(this,Xh,"m",wCe).call(this,a);if(i.controller.signal?.aborted)throw new Il;dn(this,Xh,"m",SCe).call(this)}_connected(){this.ended||(dn(this,bee,"f").call(this),this._emit("connect"))}get ended(){return dn(this,e8,"f")}get errored(){return dn(this,vee,"f")}get aborted(){return dn(this,wee,"f")}abort(){this.controller.abort()}on(e,r){return(dn(this,xC,"f")[e]||(dn(this,xC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=dn(this,xC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(dn(this,xC,"f")[e]||(dn(this,xC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{qf(this,dB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){qf(this,dB,!0,"f"),await dn(this,Z3,"f")}get currentMessage(){return dn(this,mT,"f")}async finalMessage(){return await this.done(),dn(this,Xh,"m",bCe).call(this)}async finalText(){return await this.done(),dn(this,Xh,"m",p0t).call(this)}_emit(e,...r){if(dn(this,e8,"f"))return;e==="end"&&(qf(this,e8,!0,"f"),dn(this,_ee,"f").call(this));let n=dn(this,xC,"f")[e];if(n&&(dn(this,xC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!dn(this,dB,"f")&&!n?.length&&Promise.reject(o),dn(this,X3,"f").call(this,o),dn(this,Q3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!dn(this,dB,"f")&&!n?.length&&Promise.reject(o),dn(this,X3,"f").call(this,o),dn(this,Q3,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",dn(this,Xh,"m",bCe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),dn(this,Xh,"m",vCe).call(this),this._connected();let o=Jd.fromReadableStream(e,this.controller);for await(let i of o)dn(this,Xh,"m",wCe).call(this,i);if(o.controller.signal?.aborted)throw new Il;dn(this,Xh,"m",SCe).call(this)}[(mT=new WeakMap,yee=new WeakMap,bee=new WeakMap,X3=new WeakMap,Z3=new WeakMap,_ee=new WeakMap,Q3=new WeakMap,xC=new WeakMap,e8=new WeakMap,vee=new WeakMap,wee=new WeakMap,dB=new WeakMap,_Ce=new WeakMap,Xh=new WeakSet,bCe=function(){if(this.receivedMessages.length===0)throw new zr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},p0t=function(){if(this.receivedMessages.length===0)throw new zr("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 zr("stream ended without producing a content block with type=text");return r.join(" ")},vCe=function(){this.ended||qf(this,mT,void 0,"f")},wCe=function(r){if(this.ended)return;let n=dn(this,Xh,"m",h0t).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);r.delta.type==="text_delta"&&o.type==="text"?this._emit("text",r.delta.text,o.text||""):r.delta.type==="input_json_delta"&&o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{qf(this,mT,n,"f");break}case"content_block_start":case"message_delta":break}},SCe=function(){if(this.ended)throw new zr("stream has ended, this shouldn't happen");let r=dn(this,mT,"f");if(!r)throw new zr("request ended without sending any chunks");return qf(this,mT,void 0,"f"),r},h0t=function(r){let n=dn(this,mT,"f");if(r.type==="message_start"){if(n)throw new zr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new zr(`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[m0t]||"";i+=r.delta.partial_json,Object.defineProperty(o,m0t,{value:i,enumerable:!1,writable:!0}),i&&(o.input=dee(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Jd(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var gT=class extends Kh{create(e,r){return e.model in g0t&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${g0t[e.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}stream(e,r){return A1.createMessage(this,e,r)}},g0t={"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"};(function(t){})(gT||(gT={}));var y0t,ri=class extends see{constructor({baseURL:e=lee("ANTHROPIC_BASE_URL"),apiKey:r=lee("ANTHROPIC_API_KEY")??null,authToken:n=lee("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&l0t())throw new zr(`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 hT(this),this.messages=new gT(this),this.beta=new pT(this),this._options=i,this.apiKey=r,this.authToken=n}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders(e,r){if(!(this.apiKey&&e["x-api-key"])&&r["x-api-key"]!==null&&!(this.authToken&&e.authorization)&&r.authorization!==null)throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders(e){let r=this.apiKeyAuth(e),n=this.bearerAuth(e);return r!=null&&!cee(r)?r:n!=null&&!cee(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};y0t=ri;ri.Anthropic=y0t;ri.HUMAN_PROMPT=`
Human:`;ri.AI_PROMPT=`
Assistant:`;ri.DEFAULT_TIMEOUT=6e5;ri.AnthropicError=zr;ri.APIError=za;ri.APIConnectionError=wC;ri.APIConnectionTimeoutError=E1;ri.APIUserAbortError=Il;ri.NotFoundError=oB;ri.ConflictError=iB;ri.RateLimitError=sB;ri.BadRequestError=tB;ri.AuthenticationError=rB;ri.InternalServerError=uB;ri.PermissionDeniedError=nB;ri.UnprocessableEntityError=aB;ri.toFile=r0t;ri.fileFromPath=oee;var{HUMAN_PROMPT:gCo,AI_PROMPT:yCo}=ri,{AnthropicError:bCo,APIError:_Co,APIConnectionError:vCo,APIConnectionTimeoutError:wCo,APIUserAbortError:SCo,NotFoundError:xCo,ConflictError:CCo,RateLimitError:OCo,BadRequestError:ECo,AuthenticationError:PCo,InternalServerError:TCo,PermissionDeniedError:MCo,UnprocessableEntityError:ACo}=fCe;(function(t){t.Completions=hT,t.Messages=gT,t.Beta=pT})(ri||(ri={}));Vh();uC();hh();sx();iE();var t8=class extends CA{static lc_name(){return"AnthropicToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","anthropic","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch(o){throw new cp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(o.message)}`,e)}else r=e;if(this.zodSchema===void 0)return r;let n=await this.zodSchema.safeParseAsync(r);if(n.success)return n.data;throw new cp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.errors)}`,JSON.stringify(r,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?xCe(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 xCe(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}function b0t(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}function _0t(t){let e,r=Array.isArray(t.content)?t.content.find(o=>o.type==="tool_use"):void 0;r&&"index"in r&&"name"in r&&"id"in r&&(e={args:"",id:r.id,name:r.name,index:r.index,type:"tool_call_chunk"});let n=Array.isArray(t.content)?t.content.find(o=>o.type==="input_json_delta"):void 0;return n&&"index"in n&&"input"in n&&(typeof n.input=="string"?e={id:n.id,name:n.name,args:n.input,index:n.index,type:"tool_call_chunk"}:e={id:n.id,name:n.name,args:JSON.stringify(n.input,null,2),index:n.index,type:"tool_call_chunk"}),e}function v0t(t){let e=/^data:(image\/.+);base64,(.+)$/,r=t.match(e);if(r===null)throw new Error(["Anthropic only supports base64-encoded images currently.","Example: data:image/png;base64,/9j/4AAQSk..."].join(`
`));return{type:"base64",media_type:r[1]??"",data:r[2]??""}}function h$r(t){let e=[];for(let r of t)if(r._getType()==="tool")if(typeof r.content=="string"){let n=e[e.length-1];n?._getType()==="human"&&Array.isArray(n.content)&&"type"in n.content[0]&&n.content[0].type==="tool_result"?n.content.push({type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}):e.push(new Qa({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Qa({content:r.content}));else{let n=e[e.length-1];if(n?._getType()==="human"&&r._getType()==="human"){let o;typeof n.content=="string"?o=[{type:"text",text:n.content}]:o=n.content,typeof r.content=="string"?o.push({type:"text",text:r.content}):o=o.concat(r.content),n.content=o}else e.push(r)}return e}function w0t(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}function S0t(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{let i="cache_control"in o?o.cache_control:void 0;if(o.type==="image_url"){let a;return typeof o.image_url=="string"?a=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(e.find(a=>a===o.type)){let a={...o};if("index"in a&&delete a.index,a.type==="input_json_delta"&&(a.type="tool_use"),"input"in a)try{a.input=JSON.parse(a.input)}catch{}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function See(t){let e=h$r(t),r;return e.length>0&&e[0]._getType()==="system"&&(r=t[0].content),{messages:(r!==void 0?e.slice(1):e).map(i=>{let a;if(i._getType()==="human")a="user";else if(i._getType()==="ai")a="assistant";else if(i._getType()==="tool")a="user";else throw i._getType()==="system"?new Error("System messages are only permitted as the first passed message."):new Error(`Message type "${i._getType()}" is not supported.`);if(Gu(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:S0t(i.content)}}}else return{role:a,content:S0t(i.content)}}),system:r}}function x0t(t,e){if(t.type==="message_start"){let{content:r,usage:n,...o}=t.message,i={};for(let[s,u]of Object.entries(o))u!=null&&(i[s]=u);let a={input_tokens:n.input_tokens,output_tokens:n.output_tokens,total_tokens:n.input_tokens+n.output_tokens};return{chunk:new Dr({content:e.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:e.streamUsage?a:void 0,id:t.message.id})}}else if(t.type==="message_delta"){let r={input_tokens:0,output_tokens:t.usage.output_tokens,total_tokens:t.usage.output_tokens};return{chunk:new Dr({content:e.coerceContentToString?"":[],additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?r:void 0})}}else{if(t.type==="content_block_start"&&t.content_block.type==="tool_use")return{chunk:new Dr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:""}],additional_kwargs:{}})};if(t.type==="content_block_delta"&&t.delta.type==="text_delta"){let r=t.delta?.text;if(r!==void 0)return{chunk:new Dr({content:e.coerceContentToString?r:[{index:t.index,...t.delta}],additional_kwargs:{}})}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new Dr({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],additional_kwargs:{}})};if(t.type==="content_block_start"&&t.content_block.type==="text"){let r=t.content_block?.text;if(r!==void 0)return{chunk:new Dr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}],additional_kwargs:{}})}}}}return null}function C0t(t,e){let r=e.usage,n=r!=null?{input_tokens:r.input_tokens??0,output_tokens:r.output_tokens??0,total_tokens:(r.input_tokens??0)+(r.output_tokens??0)}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new To({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=xCe(t);return[{text:"",message:new To({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}function m$r(t){return!!(t.tools&&t.tools.length>0)}function g$r(t){return"input_schema"in t}function y$r(t){if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)&&t.content.length>=1&&"input"in t.content[0])return typeof t.content[0].input=="string"?t.content[0].input:JSON.stringify(t.content[0].input);if(Array.isArray(t.content)&&t.content.length>=1&&"text"in t.content[0])return t.content[0].text}var CCe=class extends ba{static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"anthropicApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:2048}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"invocationKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clientOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamingClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"createClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??Yt("ANTHROPIC_API_KEY"),!this.anthropicApiKey&&!e?.createClient)throw new Error("Anthropic API key not found");this.clientOptions=e?.clientOptions??{},this.apiKey=this.anthropicApiKey,this.apiUrl=e?.anthropicApiUrl,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.invocationKwargs=e?.invocationKwargs??{},this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokensToSample??e?.maxTokens??this.maxTokens,this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.createClient=e?.createClient??(r=>new ri(r))}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"anthropic",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}formatStructuredToolToAnthropic(e){if(!(!e||!e.length))return e.map(r=>{if(g$r(r))return r;if(Vw(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Ig(r))return{name:r.name,description:r.description,input_schema:Bi(r.schema)};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.bind({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=b0t(e?.tool_choice);return{model:this.model,temperature:this.temperature,top_k:this.topK,top_p:this.topP,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,...this.invocationKwargs}}_identifyingParams(){return{model_name:this.model,...this.invocationParams()}}identifyingParams(){return{model_name:this.model,...this.invocationParams()}}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=See(e),a=!m$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=x0t(u,{streamUsage:l,coerceContentToString:a});if(!c)continue;let{chunk:d}=c,f=_0t(d),p=y$r(d);yield new Ho({message:new Dr({content:d.content,additional_kwargs:d.additional_kwargs,tool_call_chunks:f?[f]:void 0,usage_metadata:l?d.usage_metadata:void 0,response_metadata:d.response_metadata,id:d.id}),text:p??""}),p&&await n?.handleLLMNewToken(p)}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...See(e)},n),{content:i,...a}=o,s=C0t(i,a),{role:u,type:l,...c}=a;return{generations:s,llmOutput:c}}async _generate(e,r,n){if(this.stopSequences&&r.stop)throw new Error('"stopSequence" parameter found in input and default params');let o=this.invocationParams(r);if(o.stream){let i,a=this._streamResponseChunks(e,r,n);for await(let s of a)i===void 0?i=s:i=i.concat(s);if(i===void 0)throw new Error("No chunks returned from Anthropic API.");return{generations:[{text:i.text,message:i.message}]}}else return this._generateNonStreaming(e,o,{signal:r.signal,headers:r.headers})}async createStreamWithRetry(e,r){if(!this.streamingClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.streamingClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.streamingClient.messages.create({...e,...this.invocationKwargs,stream:!0},r);return this.caller.call(n)}async completionWithRetry(e,r){if(!this.batchClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.batchClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.batchClient.messages.create({...e,...this.invocationKwargs},r);return this.caller.callWithOptions({signal:r.signal??void 0},n)}_llmType(){return"anthropic"}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('Anthropic only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(kf(n)){let h=Bi(n);l=[{name:s,description:h.description??"A function available to call.",input_schema:h}],u=new t8({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 t8({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=$i.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=$i.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return ai.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},xee=class extends CCe{};hh();Vh();var R1="0.5.0";var O0t=!1,I1,OCe,b$r,_$r,v$r,ECe,w$r,Cee,PCe,TCe,MCe,Oee,ACe;function E0t(t,e={auto:!1}){if(O0t)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(I1)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${I1}'\``);O0t=e.auto,I1=t.kind,OCe=t.fetch,b$r=t.Request,_$r=t.Response,v$r=t.Headers,ECe=t.FormData,w$r=t.Blob,Cee=t.File,PCe=t.ReadableStream,TCe=t.getMultipartRequestOptions,MCe=t.getDefaultAgent,Oee=t.fileFromPath,ACe=t.isFsReadStream}var Eee=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function P0t({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'groq-sdk'`:\n- `import 'groq-sdk/shims/node'` (if you're running on Node)\n- `import 'groq-sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new Eee(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}}I1||E0t(P0t(),{auto:!0});var RCe={};nf(RCe,{APIConnectionError:()=>CC,APIConnectionTimeoutError:()=>D1,APIError:()=>Ha,APIUserAbortError:()=>yT,AuthenticationError:()=>pB,BadRequestError:()=>fB,ConflictError:()=>gB,GroqError:()=>Dl,InternalServerError:()=>_B,NotFoundError:()=>mB,PermissionDeniedError:()=>hB,RateLimitError:()=>bB,UnprocessableEntityError:()=>yB});var Dl=class extends Error{},Ha=class extends Dl{constructor(e,r,n,o){super(`${Ha.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new CC({cause:Pee(r)});let i=r;return e===400?new fB(e,i,n,o):e===401?new pB(e,i,n,o):e===403?new hB(e,i,n,o):e===404?new mB(e,i,n,o):e===409?new gB(e,i,n,o):e===422?new yB(e,i,n,o):e===429?new bB(e,i,n,o):e>=500?new _B(e,i,n,o):new Ha(e,i,n,o)}},yT=class extends Ha{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},CC=class extends Ha{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},D1=class extends CC{constructor({message:e}={}){super({message:e??"Request timed out."})}},fB=class extends Ha{constructor(){super(...arguments),this.status=400}},pB=class extends Ha{constructor(){super(...arguments),this.status=401}},hB=class extends Ha{constructor(){super(...arguments),this.status=403}},mB=class extends Ha{constructor(){super(...arguments),this.status=404}},gB=class extends Ha{constructor(){super(...arguments),this.status=409}},yB=class extends Ha{constructor(){super(...arguments),this.status=422}},bB=class extends Ha{constructor(){super(...arguments),this.status=429}},_B=class extends Ha{};var OC=class{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new ICe;async function*i(){if(!e.body)throw r.abort(),new Dl("Attempted to iterate over a response with no body");let s=new EC,u=T0t(e.body);for await(let l of u)for(let c of s.decode(l)){let d=o.decode(c);d&&(yield d)}for(let l of s.flush()){let c=o.decode(l);c&&(yield c)}}async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let s=!1;try{for await(let u of i())if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null){let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(l&&l.error)throw new Ha(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 OC(a,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new EC,s=T0t(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new OC(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new OC(()=>o(e),this.controller),new OC(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new PCe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}},ICe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=x$r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},EC=class{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=EC.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(EC.NEWLINE_REGEXP);return o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Dl(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Dl(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Dl("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};EC.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);EC.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function x$r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function T0t(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var M0t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",A0t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Tee(t),Tee=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",C$r=t=>A0t(t)||M0t(t)||ACe(t);async function NCe(t,e,r){if(t=await t,r??(r=A0t(t)?{lastModified:t.lastModified,type:t.type}:{}),M0t(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Cee([o],e,r)}let n=await O$r(t);if(e||(e=P$r(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Cee(n,e,r)}async function O$r(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Tee(t))e.push(await t.arrayBuffer());else if(T$r(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${E$r(t)}`);return e}function E$r(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function P$r(t){return DCe(t.name)||DCe(t.filename)||DCe(t.path)?.split(/[\\/]/).pop()}var DCe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},T$r=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",LCe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var r8=async t=>{let e=await R0t(t.body);return TCe(e,t)},R0t=async t=>{let e=new ECe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>jCe(e,r,n))),e};var jCe=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(C$r(r)){let n=await NCe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>jCe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>jCe(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var A$r=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},R$r=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Mee;async function F0t(t){let{response:e}=t;if(t.options.stream)return vB("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):OC.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return vB("response",e.status,e.url,e.headers,i),i}let o=await e.text();return vB("response",e.status,e.url,e.headers,o),o}var wB=class extends Promise{constructor(e,r=F0t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new wB(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Aee=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=FCe("maxRetries",r),this.timeout=FCe("timeout",n),this.httpAgent=o,this.fetch=i??OCe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...N$r(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${U$r()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&Tee(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e){let{method:r,path:n,query:o,headers:i={}}=e,a=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:LCe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in e&&FCe("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??MCe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:e.signal??null},url:u,timeout:l}}buildHeaders({options:e,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(e);return L0t(o,i),L0t(o,r),LCe(e.body)&&I1!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return Ha.generate(e,r,n,o)}request(e,r=null){return new wB(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e;r==null&&(r=n.maxRetries??this.maxRetries),await this.prepareOptions(n);let{req:o,url:i,timeout:a}=this.buildRequest(n);if(await this.prepareRequest(o,{url:i,options:n}),vB("request",i,n,o.headers),n.signal?.aborted)throw new yT;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Pee);if(u instanceof Error){if(n.signal?.aborted)throw new yT;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new D1:new CC({cause:u})}let l=I$r(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return vB(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>Pee(m).message),d=L$r(c),f=d?void 0:c;throw vB(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,u.status,i,l,f),this.makeStatusError(u.status,d,f,l)}return{response:u,options:n,controller:s}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new kCe(this,n,e)}buildURL(e,r){let n=k$r(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return $$r(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new Dl(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n);return this.getRequestClient().fetch.call(void 0,e,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await B$r(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${R1}`}},I0t=class{constructor(e,r,n,o){Mee.set(this,void 0),A$r(this,Mee,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new Dl("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await R$r(this,Mee,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Mee=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},kCe=class extends wB{constructor(e,r,n){super(r,async o=>new n(e,o.response,await F0t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},I$r=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var D$r=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":R1,"X-Stainless-OS":j0t(Deno.build.os),"X-Stainless-Arch":D0t(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":R1,"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":R1,"X-Stainless-OS":j0t(process.platform),"X-Stainless-Arch":D0t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=j$r();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":R1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":R1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function j$r(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var D0t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",j0t=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),N0t,N$r=()=>N0t??(N0t=D$r()),L$r=t=>{try{return JSON.parse(t)}catch{return}},F$r=new RegExp("^(?:[a-z]+:)?//","i"),k$r=t=>F$r.test(t),B$r=t=>new Promise(e=>setTimeout(e,t)),FCe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Dl(`${t} must be an integer`);if(e<0)throw new Dl(`${t} must be a positive integer`);return e},Pee=t=>t instanceof Error?t:new Error(t);var BCe=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function $$r(t){if(!t)return!0;for(let e in t)return!1;return!0}function q$r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function L0t(t,e){for(let r in e){if(!q$r(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function vB(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var U$r=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),k0t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var jl=class{constructor(e){this._client=e}};var j1=class extends jl{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",r8({body:e,...r}))}};(function(t){})(j1||(j1={}));var N1=class extends jl{create(e,r){return this._client.post("/openai/v1/audio/translations",r8({body:e,...r}))}};(function(t){})(N1||(N1={}));var bT=class extends jl{constructor(){super(...arguments),this.transcriptions=new j1(this._client),this.translations=new N1(this._client)}};(function(t){t.Transcriptions=j1,t.Translations=N1})(bT||(bT={}));var L1=class extends jl{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};(function(t){})(L1||(L1={}));var _T=class extends jl{constructor(){super(...arguments),this.completions=new L1(this._client)}};(function(t){t.Completions=L1})(_T||(_T={}));var vT=class extends jl{};(function(t){})(vT||(vT={}));var wT=class extends jl{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};(function(t){})(wT||(wT={}));var ST=class extends jl{retrieve(e,r){return this._client.get(`/openai/v1/models/${e}`,r)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,r){return this._client.delete(`/openai/v1/models/${e}`,r)}};(function(t){})(ST||(ST={}));var B0t,Va=class extends Aee{constructor({baseURL:e=BCe("GROQ_BASE_URL"),apiKey:r=BCe("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Dl("The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).");let o={apiKey:r,...n,baseURL:e||"https://api.groq.com"};if(!o.dangerouslyAllowBrowser&&k0t())throw new Dl(`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 vT(this),this.chat=new _T(this),this.embeddings=new wT(this),this.audio=new bT(this),this.models=new ST(this),this._options=o,this.apiKey=r}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}};B0t=Va;Va.Groq=B0t;Va.GroqError=Dl;Va.APIError=Ha;Va.APIConnectionError=CC;Va.APIConnectionTimeoutError=D1;Va.APIUserAbortError=yT;Va.NotFoundError=mB;Va.ConflictError=gB;Va.RateLimitError=bB;Va.BadRequestError=fB;Va.AuthenticationError=pB;Va.InternalServerError=_B;Va.PermissionDeniedError=hB;Va.UnprocessableEntityError=yB;Va.toFile=NCe;Va.fileFromPath=Oee;var{GroqError:rEo,APIError:nEo,APIConnectionError:oEo,APIConnectionTimeoutError:iEo,APIUserAbortError:aEo,NotFoundError:sEo,ConflictError:uEo,RateLimitError:lEo,BadRequestError:cEo,AuthenticationError:dEo,InternalServerError:fEo,PermissionDeniedError:pEo,UnprocessableEntityError:hEo}=RCe;(function(t){t.Completions=vT,t.Chat=_T,t.Embeddings=wT,t.Audio=bT,t.Models=ST})(Va||(Va={}));var $0t=Va;sx();iE();function G$r(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";default:throw new Error(`Unknown message type: ${e}`)}}function q0t(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:G$r(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return Gu(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Bk):(e.additional_kwargs.tool_calls!=null&&(r.tool_calls=e.additional_kwargs.tool_calls),e.tool_call_id!=null&&(r.tool_call_id=e.tool_call_id)),r})}function K$r(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(m1(i,{returnId:!0}))}catch(a){o.push($k(i,a.message))}return new To({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Gl(t.content||"",t.role??"unknown")}}function Y$r(t,e){if(t?.length)return t.map(r=>({id:r.id,name:r.function?.name,args:r.function?.arguments,type:"tool_call_chunk",index:e}))}function X$r(t,e,r){let{role:n}=t,o=t.content??"",i;t.function_call?i={function_call:t.function_call}:t.tool_calls?i={tool_calls:t.tool_calls}:i={};let a,s;if(r?.usage&&(a={input_tokens:r.usage.prompt_tokens,output_tokens:r.usage.completion_tokens,total_tokens:r.usage.total_tokens},s=r.id),n==="user")return{message:new sp({content:o})};if(n==="assistant"){let u=Y$r(t.tool_calls,e);return{message:new Dr({content:o,additional_kwargs:i,tool_call_chunks:u?u.map(l=>({type:l.type,args:l.args,index:l.index})):void 0,usage_metadata:a,id:s}),toolCallData:u?u.map(l=>({id:l.id??"",name:l.name??"",index:l.index??e,type:"tool_call_chunk"})):void 0}}else return n==="system"?{message:new ph({content:o})}:{message:new ap({content:o,role:n})}}var Ree=class extends ba{static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","groq"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey||Yt("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 $0t({apiKey:r,dangerouslyAllowBrowser:!0}),this.apiKey=r,this.temperature=e?.temperature??this.temperature,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.streaming=e?.streaming??this.streaming,this.stop=e?.stopSequences??(typeof e?.stop=="string"?[e.stop]:e?.stop)??[],this.stopSequences=this.stop,this.maxTokens=e?.maxTokens}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"groq",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??this.temperature,ls_max_tokens:r.max_tokens??this.maxTokens,ls_stop:e.stop}}async completionWithRetry(e,r){return this.caller.call(async()=>this.client.chat.completions.create(e,r))}invocationParams(e){let r=super.invocationParams(e);return e.tool_choice!==void 0&&(r.tool_choice=e.tool_choice),e.tools!==void 0&&(r.tools=e.tools),e.response_format!==void 0&&(r.response_format=e.response_format),{...r,stop:e.stop??this.stopSequences,model:this.model,temperature:this.temperature,max_tokens:this.maxTokens}}bindTools(e,r){return this.bind({tools:e.map(n=>tk(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=q0t(e),a=await this.completionWithRetry({...o,messages:i,stream:!0},{signal:r?.signal,headers:r?.headers}),s="",u=[],l;for await(let c of a){l=c;let d=c?.choices[0];if(!d)continue;d.delta?.role&&(s=d.delta.role);let{message:f,toolCallData:p}=X$r({...d.delta,role:s},d.index,c.x_groq);if(p){let m=p.filter(v=>u.every(g=>g.id!==v.id));u.push(...m),yield new Ho({message:new Dr({content:"",tool_call_chunks:m}),text:""})}let h=new Ho({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 Ho({message:new Dr({content:"",response_metadata:l}),text:""})),r.signal?.aborted)throw new Error("AbortError")}async _generate(e,r,n){if(this.streaming){let o={},i=this._streamResponseChunks(e,r,n),a={};for await(let u of i){let l=u.generationInfo?.completion??0;a[l]===void 0?a[l]=u:a[l]=a[l].concat(u)}return{generations:Object.entries(a).sort(([u],[l])=>parseInt(u,10)-parseInt(l,10)).map(([u,l])=>l),llmOutput:{estimatedTokenUsage:o}}}else return this._generateNonStreaming(e,r,n)}async _generateNonStreaming(e,r,n){let o={},i=this.invocationParams(r),a=q0t(e),s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,headers:r?.headers});if("usage"in s&&s.usage){let{completion_tokens:l,prompt_tokens:c,total_tokens:d}=s.usage;l&&(o.completionTokens=(o.completionTokens??0)+l),c&&(o.promptTokens=(o.promptTokens??0)+c),d&&(o.totalTokens=(o.totalTokens??0)+d)}let u=[];if("choices"in s&&s.choices)for(let l of s.choices){let c=l.message?.content??"",d;o.totalTokens!==void 0&&(d={input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens});let f={text:c,message:K$r(l.message??{role:"assistant"},d)};f.generationInfo={...l.finish_reason?{finish_reason:l.finish_reason}:{},...l.logprobs?{logprobs:l.logprobs}:{}},u.push(f)}return{generations:u,llmOutput:{tokenUsage:o}}}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s=o??"extract",u,l;if(i==="jsonMode")l=this.bind({response_format:{type:"json_object"}}),kf(n)?u=ox.fromZodSchema(n):u=new ix;else if(kf(n)){let p=Bi(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Fg({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 Fg({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=$i.assign({parsed:(p,h)=>u.invoke(p.raw,h)}),d=$i.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return ai.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var yc=[];for(Iee=0;Iee<256;++Iee)yc.push((Iee+256).toString(16).slice(1));var Iee;function U0t(t,e=0){return(yc[t[e+0]]+yc[t[e+1]]+yc[t[e+2]]+yc[t[e+3]]+"-"+yc[t[e+4]]+yc[t[e+5]]+"-"+yc[t[e+6]]+yc[t[e+7]]+"-"+yc[t[e+8]]+yc[t[e+9]]+"-"+yc[t[e+10]]+yc[t[e+11]]+yc[t[e+12]]+yc[t[e+13]]+yc[t[e+14]]+yc[t[e+15]]).toLowerCase()}var Dee,Z$r=new Uint8Array(16);function $Ce(){if(!Dee&&(Dee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dee(Z$r)}var Q$r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qCe={randomUUID:Q$r};function eqr(t,e,r){if(qCe.randomUUID&&!e&&!t)return qCe.randomUUID();t=t||{};var n=t.random||(t.rng||$Ce)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return U0t(n)}var jee=eqr;var XAt=B(JAt(),1),ZAt=B(p8(),1);Vh();Rj();iE();sx();hh();var ern=/^[a-zA-Z0-9]{9}$/;function trn(t){return ern.test(t)}function rrn(t){let e=t,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(e===0)return r[0];let n=[],o=r.length;for(;e;)n.push(r[e%o]),e=Math.floor(e/o);return n.reverse().join("")}function nrn(t){let e=0;for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);e=(e<<5)-e+n,e&=e}return Math.abs(e)}function CPe(t){if(trn(t))return t;{let e=nrn(t),r=rrn(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function OPe(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}function GAt(t){let e=o=>{switch(o){case"human":return"user";case"ai":return"assistant";case"system":return"system";case"tool":return"tool";case"function":return"assistant";default:throw new Error(`Unknown message type: ${o}`)}},r=(o,i)=>{let a=(s,u)=>{if(s.type==="image_url"&&(u==="user"||u==="assistant"))return{type:s.type,imageUrl:s?.image_url};if(s.type==="text")return{type:s.type,text:s?.text};throw new Error(`ChatMistralAI only supports messages of "image_url" for roles "user" and "assistant", and "text" for all others.
Received: ${JSON.stringify(o,null,2)}`)};if(typeof o=="string")return o;if(Array.isArray(o)){let s=e(i),u=[];return o.forEach(l=>{if(l.type==="text"||l.type==="image_url")u.push(a(l,s));else throw new Error('Mistral only supports types "text" or "image_url" for complex message types.')}),u}throw new Error(`Message content must be a string or an array.
Received: ${JSON.stringify(o,null,2)}`)},n=o=>{if(Gu(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:CPe(i.id??"")})).map(Bk)};return t.map(o=>{let i=n(o),a=r(o.content,o.getType());return"tool_call_id"in o&&typeof o.tool_call_id=="string"?{role:e(o.getType()),content:a,name:o.name,toolCallId:CPe(o.tool_call_id)}:Gu(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function orn(t,e){let{message:r}=t;if(r===void 0)throw new Error("No message found in response");let n=[];"toolCalls"in r&&Array.isArray(r.toolCalls)&&(n=r.toolCalls);let o=OPe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=m1(s,{returnId:!0});i.push({...u,id:u.id??jee().replace(/-/g,"")})}catch(u){a.push($k(s,u.message))}return new To({content:o,tool_calls:i,invalid_tool_calls:a,additional_kwargs:{},usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0})}default:return new Qa({content:o})}}function irn(t,e){if(!t.content&&!t.toolCalls)return e?new Dr({content:"",usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):null;let r=t.toolCalls?.length?t.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??jee().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=OPe(t.content),i,a=[];if(r!==void 0)for(let s of r){let u=s.function?.arguments,l=u===void 0||typeof u=="string"?u:JSON.stringify(u);a.push({name:s.function?.name,args:l,id:s.id,index:s.index,type:"tool_call_chunk"})}else i={};return n==="user"?new sp({content:o}):n==="assistant"?new Dr({content:o,tool_call_chunks:a,additional_kwargs:i,usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):n==="tool"?new Oy({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new Hm({content:o,additional_kwargs:i}):new ap({content:o,role:n})}function KAt(t){return t.map(e=>{if("function"in e)return e;let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Bi(e.schema)}}})}var Lne=class extends ba{static lc_name(){return"ChatMistralAI"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","mistralai"]}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mistral-small-latest"}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endpoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serverURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"safeMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"safePrompt",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"randomSeed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"beforeRequestHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestErrorHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"responseHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCompletions",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??Yt("MISTRAL_API_KEY");if(!r)throw new Error("API key MISTRAL_API_KEY is missing for MistralAI, but it is required.");this.apiKey=r,this.streaming=e?.streaming??this.streaming,this.serverURL=e?.serverURL??this.serverURL,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokens??this.maxTokens,this.safePrompt=e?.safePrompt??this.safePrompt,this.randomSeed=e?.seed??e?.randomSeed??this.seed,this.seed=this.randomSeed,this.maxRetries=e?.maxRetries,this.httpClient=e?.httpClient,this.model=e?.model??e?.modelName??this.model,this.streamUsage=e?.streamUsage??this.streamUsage,this.beforeRequestHooks=e?.beforeRequestHooks??this.beforeRequestHooks,this.requestErrorHooks=e?.requestErrorHooks??this.requestErrorHooks,this.responseHooks=e?.responseHooks??this.responseHooks,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.numCompletions=e?.numCompletions??this.numCompletions,this.addAllHooksToHttpClient()}get lc_secrets(){return{apiKey:"MISTRAL_API_KEY"}}get lc_aliases(){return{apiKey:"mistral_api_key"}}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"mistral",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.maxTokens??void 0}}_llmType(){return"mistral_ai"}invocationParams(e){let{response_format:r,tools:n,tool_choice:o}=e??{},i=n?.length?KAt(n):void 0;return{model:this.model,tools:i,temperature:this.temperature,maxTokens:this.maxTokens,topP:this.topP,randomSeed:this.seed,safePrompt:this.safePrompt,toolChoice:o,responseFormat:r,presencePenalty:this.presencePenalty,frequencyPenalty:this.frequencyPenalty,n:this.numCompletions}}bindTools(e,r){return this.bind({tools:KAt(e),...r})}async completionWithRetry(e,r){let n=new lp({maxRetries:this.maxRetries}),o=new XAt.Mistral({apiKey:this.apiKey,serverURL:this.serverURL,...this.httpClient?{httpClient:this.httpClient}:{}});return n.call(async()=>{try{let i;return r?i=await o.chat.stream(e):i=await o.chat.complete(e),i}catch(i){throw(i.message?.includes("status: 400")||i.message?.toLowerCase().includes("status 400")||i.message?.includes("validation failed"))&&(i.status=400),i}})}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=GAt(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let h=this._streamResponseChunks(e,r,n),m={};for await(let g of h){let _=g.generationInfo?.completion??0;m[_]===void 0?m[_]=g:m[_]=m[_].concat(g)}return{generations:Object.entries(m).sort(([g],[_])=>parseInt(g,10)-parseInt(_,10)).map(([g,_])=>_),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let 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 v={text:m,message:orn(h,l?.usage)};h.finishReason&&(v.generationInfo={finishReason:h.finishReason}),p.push(v)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=GAt(e),a={...this.invocationParams(r),messages:o},s=await this.completionWithRetry(a,!0);for await(let{data:u}of s){if(r.signal?.aborted)throw new Error("AbortError");let l=u?.choices[0];if(!l||!("delta"in l))continue;let{delta:c}=l;if(!c)continue;let d={prompt:0,completion:l.index??0},f=this.streamUsage||r.streamUsage,p=irn(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 Ho({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 ZAt.HTTPClient),this.beforeRequestHooks)for(let r of this.beforeRequestHooks)this.httpClient?.addHook("beforeRequest",r);if(this.requestErrorHooks)for(let r of this.requestErrorHooks)this.httpClient?.addHook("requestError",r);if(this.responseHooks)for(let r of this.responseHooks)this.httpClient?.addHook("response",r)}catch{throw new Error("Error in adding all hooks")}}removeAllHooksFromHttpClient(){try{if(this.beforeRequestHooks)for(let e of this.beforeRequestHooks)this.httpClient?.removeHook("beforeRequest",e);if(this.requestErrorHooks)for(let e of this.requestErrorHooks)this.httpClient?.removeHook("requestError",e);if(this.responseHooks)for(let e of this.responseHooks)this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hooks")}}removeHookFromHttpClient(e){try{this.httpClient?.removeHook("beforeRequest",e),this.httpClient?.removeHook("requestError",e),this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hook")}}_combineLLMOutput(){return[]}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s,u;if(i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),YAt(n)?u=ox.fromZodSchema(n):u=new ix;else{let f=o??"extract";if(YAt(n)){let p=Bi(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Fg({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 Fg({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=$i.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=$i.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return ai.from([{raw:s},d])}};function YAt(t){return typeof t?.parse=="function"}Vh();var Fne=require("obsidian"),arn={["openai"]:nS,["azure openai"]:nS,["anthropic"]:xee,["cohereai"]:fZ,["google"]:bZ,["openrouterai"]:nS,["ollama"]:SZ,["lm-studio"]:nS,["groq"]:Ree,["3rd party (openai-format)"]:nS,["copilot-plus"]:nS,["mistralai"]:Lne},Eo=class{constructor(){this.providerApiKeyMap={["openai"]:()=>me().openAIApiKey,["google"]:()=>me().googleApiKey,["azure openai"]:()=>me().azureOpenAIApiKey,["anthropic"]:()=>me().anthropicApiKey,["cohereai"]:()=>me().cohereApiKey,["openrouterai"]:()=>me().openRouterAiApiKey,["groq"]:()=>me().groqApiKey,["ollama"]:()=>"default-key",["lm-studio"]:()=>"default-key",["3rd party (openai-format)"]:()=>"default-key",["copilot-plus"]:()=>me().plusLicenseKey,["mistralai"]:()=>me().mistralApiKey};this.buildModelMap(),bl(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return Eo.instance||(Eo.instance=new Eo),Eo.instance}async getModelConfig(e){let r=me(),n=e.name,o=jA(n),i={modelName:n,temperature:e.temperature??r.temperature,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors},s={["openai"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Kl:void 0,organization:await Qo(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},["anthropic"]:{anthropicApiKey:await Qo(e.apiKey||r.anthropicApiKey),modelName:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Kl:void 0}},["azure openai"]:{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await Qo(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:`https://copilot-experimental.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Qo(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Kl:void 0},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},["cohereai"]:{apiKey:await Qo(e.apiKey||r.cohereApiKey),model:n},["google"]:{apiKey:await Qo(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:UI.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:zI.BLOCK_NONE},{category:UI.HARM_CATEGORY_HATE_SPEECH,threshold:zI.BLOCK_NONE},{category:UI.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:zI.BLOCK_NONE},{category:UI.HARM_CATEGORY_HARASSMENT,threshold:zI.BLOCK_NONE}],baseUrl:e.baseUrl},["openrouterai"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Kl:void 0}},["groq"]:{apiKey:await Qo(e.apiKey||r.groqApiKey),modelName:n},["ollama"]:{model:n,apiKey:e.apiKey||"default-key",baseUrl:e.baseUrl||"http://localhost:11434"},["lm-studio"]:{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Kl:void 0}},["3rd party (openai-format)"]:{modelName:n,openAIApiKey:await Qo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Kl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},["copilot-plus"]:{modelName:n,openAIApiKey:await Qo(r.plusLicenseKey),configuration:{baseURL:LA,fetch:e.enableCors?Kl:void 0}},["mistralai"]:{model:n,apiKey:await Qo(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl}}[e.provider]||{},u=this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature);return{...i,...s,...u}}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:1}:{maxTokens:r,temperature:n}}buildModelMap(){let e=me().activeModels;Eo.modelMap={};let r=Eo.modelMap;(e??dE).forEach(o=>{if(o.enabled){if(!Object.values(NA).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=an(o);r[u]={hasApiKey:Boolean(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=arn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!Eo.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return Eo.chatModel}async setChatModel(e){let r=an(e);if(n9(r),!Eo.modelMap.hasOwnProperty(r))throw new Error(`No model found for: ${r}`);let n=Eo.modelMap[r];if(!n.hasApiKey){let i=`API key is not provided for the model: ${r}. Model switch failed.`;throw new Fne.Notice(i),new Error(i)}let o=await this.getModelConfig(e);try{let i=new n.AIConstructor({...o});Eo.chatModel=i}catch(i){console.error(i),new Fne.Notice(`Error creating model: ${r}`)}}validateChatModel(e){return e!=null}async countTokens(e){return Eo.chatModel?.getNumTokens(e)??0}validateCurrentModel(){if(!Eo.chatModel)return;let e=o9();if(!e)return;Eo.modelMap[e]?.hasApiKey||(Eo.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=jA(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 Fne.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: `+ia(n)+`
with CORS Error: `+ia(o);throw new Error(i)}}}findModelByName(e){return me().activeModels.find(n=>n.name===e)}};async function kne(t,e){let r=`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
If there's nothing in the chat history, just return the follow up question.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`,n=e.map(([a,s])=>`Human: ${a}
Assistant: ${s}`).join(`
`),i=await Eo.getInstance().getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return Kj(i.content)}var EPe=require("obsidian"),QAt=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@web":return"Search the web for information";case"@youtube":return"Get the transcript of a YouTube video. Example: @youtube <video_url>";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";default:return""}},KB=class{static async callTool(e,r){try{if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(console.warn(`Tool ${e.name} returned null/undefined result`),null)}catch(n){return console.error("Error calling tool:",n),n instanceof Error?new EPe.Notice(n.message):new EPe.Notice("An error occurred while executing the tool. Check console for details."),null}}};var g1t=require("obsidian");MA();tE();hf();Ey();var Bne=class extends nn{constructor(e){super(e),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.callbacks=e?.callbacks,this.tags=e?.tags??[],this.metadata=e?.metadata??{},this.verbose=e?.verbose??!1}_getRelevantDocuments(e,r){throw new Error("Not implemented!")}async invoke(e,r){return this.getRelevantDocuments(e,jr(r))}async getRelevantDocuments(e,r){let n=jr(vA(r)),i=await(await _i.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(e,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}};var qT=class extends Bne{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Vc.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=Ry(r,app.vault),i=await this.getExplicitChunks(o),a=r;n?.runName!=="no_hyde"&&(a=await this.rewriteQuery(r));let s=await this.getOramaChunks(a,this.options.salientTerms,this.options.textWeight),u=this.filterAndFormatChunks(s,i),l=u;if(u.length===0)return me().debug&&console.log("No chunks found for query:",r),l;let c=u.reduce((p,h)=>{let m=h.metadata.score;return typeof m=="number"&&!isNaN(m)?Math.max(p,m):p},0),d=u.every(p=>typeof p.metadata.score!="number"||isNaN(p.metadata.score)),f=this.options.useRerankerThreshold&&(c<this.options.useRerankerThreshold||d);return f&&(l=(await Sa.getInstance().rerank(r,u.map(h=>h.pageContent.slice(0,3e3)))).response.data.map(h=>({...u[h.index],metadata:{...u[h.index].metadata,rerank_score:h.relevance_score}}))),me().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
Original Query: `,r),console.log("Rewritten Query: ",a)),console.log(`
Explicit Chunks: `,i),console.log("Orama Chunks: ",s),console.log("Combined Chunks: ",u),console.log("Max Orama Score: ",c),f?console.log("Reranked Chunks: ",l):console.log("No reranking applied.")),l}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),i=await Eo.getInstance().getChatModel().bind({temperature:0}).invoke(n);return i&&"content"in i?Kj(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 Ki.getInstance().getDb(),a=await Wd.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new _C({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 Ki.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&&(me().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);hr("==== Daily note date range: ====",d[0],d[d.length-1]);let f=Ry(d.join(", "),app.vault),h=(await this.getExplicitChunks(f)).map(S=>({...S,metadata:{...S.metadata,includeInContext:!0}}));hr("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let v=(await gc(a,s)).hits.map(S=>new _C({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,...v];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)}me().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await gc(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 _C({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 vo.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}}))}};Pd();var PPe=Lp(async({timeRange:t,query:e,salientTerms:r})=>{if(await Ki.getInstance().isIndexEmpty())throw new ir(Y5);let o=t!==void 0,i=me().maxSourceChunks<Rle?Rle:me().maxSourceChunks;me().debug&&console.log("returnAll:",o);let u=(await new qT({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:Eke,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e)).map(l=>({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:Pr.object({timeRange:Pr.object({startTime:Pr.any(),endTime:Pr.any()}).optional(),query:Pr.string().describe("The search query"),salientTerms:Pr.array(Pr.string()).describe("List of salient terms extracted from the query")})}),eRt=Lp(async()=>{try{let t=await Ki.getInstance().indexVaultToVectorStore();return`Please report whether the indexing was successful.
If success is true, just say it is successful. If 0 files is indexed, say there are no new files to index.`+JSON.stringify({success:!0,message:t===0?"No new files to index.":`Indexed ${t} files in the vault.`})}catch(t){return console.error("Error indexing vault:",t),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),TPe=Lp(async({query:t,chatHistory:e})=>{try{let r=await kne(t,e),n=await Sa.getInstance().webSearch(r),o=n.response.citations||[],i=o.length>0?`
Sources:
`+o.map((a,s)=>`[${s+1}] ${a}`).join(`
`):"";return`Here are the web search results. Please provide a response based on this information and include source citations listed at the end of your response under the heading '#### Sources' as a list of markdown links. For each URL, create a descriptive title based on the domain and path and return it in the markdown format '- [title](url)':
`+n.response.choices[0].message.content+i}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}},{name:"webSearch",description:"Search the web for information",schema:Pr.object({query:Pr.string().describe("The search query"),chatHistory:Pr.array(Pr.tuple([Pr.string(),Pr.string()])).describe("Previous conversation turns")})});var oRt=B(tRt(),1),z8=B(UT(),1);var jn;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(jn||(jn={}));var ku;(function(t){t[t.SUNDAY=0]="SUNDAY",t[t.MONDAY=1]="MONDAY",t[t.TUESDAY=2]="TUESDAY",t[t.WEDNESDAY=3]="WEDNESDAY",t[t.THURSDAY=4]="THURSDAY",t[t.FRIDAY=5]="FRIDAY",t[t.SATURDAY=6]="SATURDAY"})(ku||(ku={}));var Hp;(function(t){t[t.JANUARY=1]="JANUARY",t[t.FEBRUARY=2]="FEBRUARY",t[t.MARCH=3]="MARCH",t[t.APRIL=4]="APRIL",t[t.MAY=5]="MAY",t[t.JUNE=6]="JUNE",t[t.JULY=7]="JULY",t[t.AUGUST=8]="AUGUST",t[t.SEPTEMBER=9]="SEPTEMBER",t[t.OCTOBER=10]="OCTOBER",t[t.NOVEMBER=11]="NOVEMBER",t[t.DECEMBER=12]="DECEMBER"})(Hp||(Hp={}));function rRt(t,e){e=e.add(1,"day"),hD(t,e),YB(t,e)}function Kg(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function $ne(t,e){t.assign("hour",e.hour()),t.assign("minute",e.minute()),t.assign("second",e.second()),t.assign("millisecond",e.millisecond()),t.get("hour")<12?t.assign("meridiem",jn.AM):t.assign("meridiem",jn.PM)}function hD(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function YB(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var DPe=B(UT(),1);var srn={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:2*60,timezoneOffsetNonDst:60,dstStart:t=>nRt(t,Hp.MARCH,ku.SUNDAY,2),dstEnd:t=>nRt(t,Hp.OCTOBER,ku.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-5*60,timezoneOffsetNonDst:-6*60,dstStart:t=>zT(t,Hp.MARCH,ku.SUNDAY,2,2),dstEnd:t=>zT(t,Hp.NOVEMBER,ku.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-4*60,timezoneOffsetNonDst:-5*60,dstStart:t=>zT(t,Hp.MARCH,ku.SUNDAY,2,2),dstEnd:t=>zT(t,Hp.NOVEMBER,ku.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-6*60,timezoneOffsetNonDst:-7*60,dstStart:t=>zT(t,Hp.MARCH,ku.SUNDAY,2,2),dstEnd:t=>zT(t,Hp.NOVEMBER,ku.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-7*60,timezoneOffsetNonDst:-8*60,dstStart:t=>zT(t,Hp.MARCH,ku.SUNDAY,2,2),dstEnd:t=>zT(t,Hp.NOVEMBER,ku.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 zT(t,e,r,n,o=0){let i=0,a=0;for(;a<n;)i++,new Date(t,e-1,i).getDay()===r&&a++;return new Date(t,e-1,i,o)}function nRt(t,e,r,n=0){let o=r===0?7:r,i=new Date(t,e-1+1,1,12),a=i.getDay()===0?7:i.getDay(),s;return a===o?s=7:a<o?s=7+a-o:s=a-o,i.setDate(i.getDate()-s),new Date(t,e-1,i.getDate(),n)}function qne(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??srn[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,DPe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,DPe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}z8.default.extend(oRt.default);var HT=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=qne(e.timezone,this.instant))}getDateWithAdjustedTimezone(){return new Date(this.instant.getTime()+this.getSystemTimezoneAdjustmentMinute(this.instant)*6e4)}getSystemTimezoneAdjustmentMinute(e,r){(!e||e.getTime()<0)&&(e=new Date);let n=-e.getTimezoneOffset(),o=r??this.timezoneOffset??n;return n-o}},en=class{constructor(e,r){if(this._tags=new Set,this.reference=e,this.knownValues={},this.impliedValues={},r)for(let o in r)this.knownValues[o]=r[o];let n=(0,z8.default)(e.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,r){return e in this.knownValues?this:(this.impliedValues[e]=r,this)}assign(e,r){return this.knownValues[e]=r,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new en(this.reference);e.knownValues={},e.impliedValues={};for(let r in this.knownValues)e.knownValues[r]=this.knownValues[r];for(let r in this.impliedValues)e.impliedValues[r]=this.impliedValues[r];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
tags: ${JSON.stringify(Array.from(this._tags).sort())},
knownValues: ${JSON.stringify(this.knownValues)},
impliedValues: ${JSON.stringify(this.impliedValues)}},
reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,z8.default)(this.date())}date(){let e=this.dateWithoutTimezoneAdjustment(),r=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get("timezoneOffset"));return new Date(e.getTime()+r*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let r of e)this._tags.add(r);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}static createRelativeFromReference(e,r){let n=(0,z8.default)(e.instant);for(let i in r)n=n.add(r[i],i);let o=new en(e);return r.hour||r.minute||r.second?($ne(o,n),Kg(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(YB(o,n),e.timezoneOffset!==null&&o.imply("timezoneOffset",-e.instant.getTimezoneOffset()),r.d?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year())):r.week?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year()),o.imply("weekday",n.day())):(o.imply("day",n.date()),r.month?(o.assign("month",n.month()+1),o.assign("year",n.year())):(o.imply("month",n.month()+1),r.year?o.assign("year",n.year()):o.imply("year",n.year())))),o}},Yg=class{constructor(e,r,n,o,i){this.reference=e,this.refDate=e.instant,this.index=r,this.text=n,this.start=o||new en(e),this.end=i}clone(){let e=new Yg(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}tags(){let e=new Set(this.start.tags());if(this.end)for(let r of this.end.tags())e.add(r);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}};function jPe(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function urn(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function xc(t){return`(?:${urn(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var iRt=B(UT(),1);function Une(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function VT(t,e,r){let n=(0,iRt.default)(t),o=n;o=o.month(r-1),o=o.date(e),o=o.year(n.year());let i=o.add(1,"y"),a=o.add(-1,"y");return Math.abs(i.diff(n))<Math.abs(o.diff(n))?o=i:Math.abs(a.diff(n))<Math.abs(o.diff(n))&&(o=a),o.year()}var FPe={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},kPe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},mm={...kPe,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},NPe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},LPe={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},sRt={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"},H8={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",...sRt},uRt=`(?:${xc(NPe)}|[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 lrn(t){let e=t.toLowerCase();return NPe[e]!==void 0?NPe[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}var XB=`(?:${xc(LPe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function ZB(t){let e=t.toLowerCase();return LPe[e]!==void 0?LPe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var WT="(?:[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 JT(t){if(/BE/i.test(t))return t=t.replace(/BE/i,""),parseInt(t)-543;if(/BCE?/i.test(t))return t=t.replace(/BCE?/i,""),-parseInt(t);if(/(AD|CE)/i.test(t))return t=t.replace(/(AD|CE)/i,""),parseInt(t);let e=parseInt(t);return Une(e)}var lRt=`(${uRt})\\s{0,3}(${xc(H8)})`,aRt=new RegExp(lRt,"i"),crn=`(${uRt})\\s{0,3}(${xc(sRt)})`,cRt="\\s{0,5},?(?:\\s*and)?\\s{0,5}",mO=jPe("(?:(?:about|around)\\s{0,3})?",lRt,cRt),GT=jPe("(?:(?:about|around)\\s{0,3})?",crn,cRt);function gm(t){let e={},r=t,n=aRt.exec(r);for(;n;)drn(e,n),r=r.substring(n[0].length).trim(),n=aRt.exec(r);return Object.keys(e).length==0?null:e}function drn(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=lrn(e[1]),n=H8[e[2].toLowerCase()];t[n]=r}var jo=class{constructor(){this.cachedInnerPattern=null,this.cachedPattern=null}innerPatternHasChange(e,r){return this.innerPattern(e)!==r}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,r){let n=r[1]??"";r.index=r.index+n.length,r[0]=r[0].substring(n.length);for(let o=2;o<r.length;o++)r[o-1]=r[o];return this.innerExtract(e,r)}};var frn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${mO})(?=\\W|$)`,"i"),prn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${mO})(?=\\W|$)`,"i"),hrn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${GT})(?=\\W|$)`,"i"),V8=class extends jo{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?hrn:e.option.forwardDate?frn:prn}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=gm(r[1]);return n?en.createRelativeFromReference(e.reference,n):null}};var mrn=new RegExp(`(?:on\\s{0,3})?(${XB})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${XB}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${xc(mm)})(?:(?:-|/|,?\\s{0,3})(${WT}(?!\\w)))?(?=\\W|$)`,"i"),dRt=1,fRt=2,grn=3,pRt=4,W8=class extends jo{innerPattern(){return mrn}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=mm[r[grn].toLowerCase()],i=ZB(r[dRt]);if(i>31)return r.index=r.index+r[dRt].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[pRt]){let a=JT(r[pRt]);n.start.assign("year",a)}else{let a=VT(e.refDate,i,o);n.start.imply("year",a)}if(r[fRt]){let a=ZB(r[fRt]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var yrn=new RegExp(`(${xc(mm)})(?:-|/|\\s*,?\\s*)(${XB})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${XB})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${WT}))?(?=\\W|$)(?!\\:\\d)`,"i"),brn=1,hRt=2,BPe=3,$Pe=4,J8=class extends jo{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return yrn}innerExtract(e,r){let n=mm[r[brn].toLowerCase()],o=ZB(r[hRt]);if(o>31||this.shouldSkipYearLikeDate&&!r[BPe]&&!r[$Pe]&&r[hRt].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[$Pe]){let u=JT(r[$Pe]);i.assign("year",u)}else{let u=VT(e.refDate,o,n);i.imply("year",u)}if(!r[BPe])return i;let a=ZB(r[BPe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var _rn=new RegExp(`((?:in)\\s*)?(${xc(mm)})\\s*(?:[,-]?\\s*(${WT})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),vrn=1,wrn=2,mRt=3,G8=class extends jo{innerPattern(){return _rn}innerExtract(e,r){let n=r[wrn].toLowerCase();if(r[0].length<=3&&!kPe[n])return null;let o=e.createParsingResult(r.index+(r[vrn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=mm[n];if(o.start.assign("month",i),r[mRt]){let a=JT(r[mRt]);o.start.assign("year",a)}else{let a=VT(e.refDate,1,i);o.start.imply("year",a)}return o}};var Srn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${xc(mm)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),xrn=1,Crn=2,gRt=3,Orn=4,K8=class extends jo{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return Srn}innerExtract(e,r){let n=parseInt(r[xrn]),o=parseInt(r[Orn]),i=r[gRt]?parseInt(r[gRt]):mm[r[Crn].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 Ern=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Prn=1,Trn=2,Y8=class extends jo{innerPattern(){return Ern}innerExtract(e,r){let n=parseInt(r[Trn]),o=parseInt(r[Prn]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function Mrn(t,e,r,n){return new RegExp(`${t}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${r}`,n)}function Arn(t,e){return new RegExp(`^(${t})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var yRt=2,QB=3,zne=4,Hne=5,X8=6,Vne=class{constructor(e=!1){this.cachedPrimaryPrefix=null,this.cachedPrimarySuffix=null,this.cachedPrimaryTimePattern=null,this.cachedFollowingPhase=null,this.cachedFollowingSuffix=null,this.cachedFollowingTimePatten=null,this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,r){let n=this.extractPrimaryTimeComponents(e,r);if(!n)return r[0].match(/^\d{4}/)?(r.index+=4,null):(r.index+=r[0].length,null);let o=r.index+r[1].length,i=r[0].substring(r[1].length),a=e.createParsingResult(o,i,n);r.index+=r[0].length;let s=e.text.substring(r.index),l=this.getFollowingTimePatternThroughCache().exec(s);return i.match(/^\d{3,4}/)&&l&&(l[0].match(/^\s*([+-])\s*\d{2,4}$/)||l[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!l||l[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,l,a),a.end&&(a.text+=l[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,r,n=!1){let o=e.createParsingComponents(),i=0,a=null,s=parseInt(r[yRt]);if(s>100){if(this.strictMode||r[QB]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[QB]!=null){if(r[QB].length==1&&!r[X8])return null;i=parseInt(r[QB])}if(i>=60)return null;if(s>12&&(a=jn.PM),r[X8]!=null){if(s>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(a=jn.AM,s==12&&(s=0)),u=="p"&&(a=jn.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",jn.AM):o.imply("meridiem",jn.PM),r[Hne]!=null){let u=parseInt(r[Hne].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[zne]!=null){let u=parseInt(r[zne]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[Hne]!=null){let u=parseInt(r[Hne].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[zne]!=null){let u=parseInt(r[zne]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[yRt]),a=0,s=-1;if(r[QB]!=null?a=parseInt(r[QB]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=jn.PM),r[X8]!=null){if(i>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(s=jn.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=jn.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==jn.AM?(n.start.imply("meridiem",jn.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",jn.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",jn.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",jn.PM)):i>12?o.imply("meridiem",jn.PM):i<=12&&o.imply("meridiem",jn.AM),o.date().getTime()<n.start.date().getTime()&&o.imply("day",o.get("day")+1),o}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)$/);if(r){let n=r[1];if(this.strictMode||n.includes(".")&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(r){if(this.strictMode)return null;let n=r[1],o=r[2];if(o.includes(".")&&!o.match(/\d(\.\d{2})+$/))return null;let i=parseInt(o),a=parseInt(n);if(i>24||a>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),r=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===r?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=Mrn(this.primaryPatternLeftBoundary(),e,r,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=r,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),r=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===r?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=Arn(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var Z8=class extends Vne{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,r){let n=super.extractPrimaryTimeComponents(e,r);if(!n)return n;if(r[0].endsWith("night")){let o=n.get("hour");o>=6&&o<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",jn.PM)):o<6&&n.assign("meridiem",jn.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",jn.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",jn.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function KT(t){let e={};for(let r in t)e[r]=-t[r];return e}function bRt(t,e){let r=t.clone(),n=t.dayjs();for(let o in e)n=n.add(e[o],o);return("day"in e||"d"in e||"week"in e||"month"in e||"year"in e)&&(r.imply("day",n.date()),r.imply("month",n.month()+1),r.imply("year",n.year())),("second"in e||"minute"in e||"hour"in e)&&(r.imply("second",n.second()),r.imply("minute",n.minute()),r.imply("hour",n.hour())),r}var Rrn=new RegExp(`(${mO})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Irn=new RegExp(`(${GT})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Q8=class extends jo{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Irn:Rrn}innerExtract(e,r){let n=gm(r[1]);if(!n)return null;let o=KT(n);return en.createRelativeFromReference(e.reference,o)}};var Drn=new RegExp(`(${mO})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),jrn=new RegExp(`(${GT})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),Nrn=1,eH=class extends jo{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?jrn:Drn}innerExtract(e,r){let n=gm(r[Nrn]);return n?en.createRelativeFromReference(e.reference,n):null}};var Wne=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},ym=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a<r.length;a++){i=r[a];let s=e.text.substring(o.index+o.text.length,i.index);if(!this.shouldMergeResults(s,o,i,e))n.push(o),o=i;else{let u=o,l=i,c=this.mergeResults(s,u,l,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}};var tH=class extends ym{shouldMergeResults(e,r,n){return!r.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){if(!r.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(i=>{r.start.isCertain(i)||r.start.imply(i,n.start.get(i))}),r.start.getCertainComponents().forEach(i=>{n.start.isCertain(i)||n.start.imply(i,r.start.get(i))})),r.start.date().getTime()>n.start.date().getTime()){let i=r.start.dayjs(),a=n.start.dayjs();n.start.isOnlyWeekdayComponent()&&a.add(7,"days").isAfter(i)?(a=a.add(7,"days"),n.start.imply("day",a.date()),n.start.imply("month",a.month()+1),n.start.imply("year",a.year())):r.start.isOnlyWeekdayComponent()&&i.add(-7,"days").isBefore(a)?(i=i.add(-7,"days"),r.start.imply("day",i.date()),r.start.imply("month",i.month()+1),r.start.imply("year",i.year())):n.start.isDateWithUnknownYear()&&a.add(1,"years").isAfter(i)?(a=a.add(1,"years"),n.start.imply("year",a.year())):r.start.isDateWithUnknownYear()&&i.add(-1,"years").isBefore(a)?(i=i.add(-1,"years"),r.start.imply("year",i.year())):[n,r]=[r,n]}let o=r.clone();return o.start=r.start,o.end=n.start,o.index=Math.min(r.index,n.index),r.index<n.index?o.text=r.text+e+n.text:o.text=n.text+e+r.text,o}};var rH=class extends tH{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function qPe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=_Rt(n,o),t.end!=null||e.end!=null){let i=t.end==null?t.start:t.end,a=e.end==null?e.start:e.end,s=_Rt(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?Kg(s,u):hD(s,u)}r.end=s}return r}function _Rt(t,e){let r=t.clone();return e.isCertain("hour")?(r.assign("hour",e.get("hour")),r.assign("minute",e.get("minute")),e.isCertain("second")?(r.assign("second",e.get("second")),e.isCertain("millisecond")?r.assign("millisecond",e.get("millisecond")):r.imply("millisecond",e.get("millisecond"))):(r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond")))):(r.imply("hour",e.get("hour")),r.imply("minute",e.get("minute")),r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond"))),e.isCertain("timezoneOffset")&&r.assign("timezoneOffset",e.get("timezoneOffset")),e.isCertain("meridiem")?r.assign("meridiem",e.get("meridiem")):e.get("meridiem")!=null&&r.get("meridiem")==null&&r.imply("meridiem",e.get("meridiem")),r.get("meridiem")==jn.PM&&r.get("hour")<12&&(e.isCertain("hour")?r.assign("hour",r.get("hour")+12):r.imply("hour",r.get("hour")+12)),r.addTags(t.tags()),r.addTags(e.tags()),r}var nH=class extends ym{shouldMergeResults(e,r,n){return(r.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&r.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){let o=r.start.isOnlyDate()?qPe(r,n):qPe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var e$=class extends nH{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var Lrn=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),oH=class{constructor(e){this.timezoneOverrides=e}refine(e,r){let n=e.option.timezones??{};return r.forEach(o=>{let i=e.text.substring(o.index+o.text.length),a=Lrn.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=qne(s,u,l);if(c==null)return;e.debug(()=>{console.log(`Extracting timezone: '${s}' into: ${c} for: ${o.start}`)});let d=o.start.get("timezoneOffset");d!==null&&c!=d&&(o.start.isCertain("timezoneOffset")||s!=a[1])||o.start.isOnlyDate()&&s!=a[1]||(o.text+=a[0],o.start.isCertain("timezoneOffset")||o.start.assign("timezoneOffset",c),o.end!=null&&!o.end.isCertain("timezoneOffset")&&o.end.assign("timezoneOffset",c))}),r}};var Frn=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),krn=1,Brn=2,$rn=3,iH=class{refine(e,r){return r.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let o=e.text.substring(n.index+n.text.length),i=Frn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[Brn]),s=parseInt(i[$rn]||"0"),u=a*60+s;u>14*60||(i[krn]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var YT=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i<r.length;i++){let a=r[i];if(a.index>=o.index+o.text.length){n.push(o),o=a;continue}let s=null,u=null;a.text.length>o.text.length?(s=a,u=o):(s=o,u=a),e.debug(()=>{console.log(`${this.constructor.name} remove ${u} by ${s}`)}),o=s}return o!=null&&n.push(o),n}};var vRt=B(UT(),1);var aH=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,vRt.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),hD(n.start,o),n.end&&n.end.isOnlyTime()&&(hD(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),hD(n.end,o))),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time result (${n.start})`)})),n.start.isOnlyWeekdayComponent()&&o.isAfter(n.start.dayjs())&&(o.day()>=n.start.get("weekday")?o=o.day(n.start.get("weekday")+7):o=o.day(n.start.get("weekday")),n.start.imply("day",o.date()),n.start.imply("month",o.month()+1),n.start.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.end.isOnlyWeekdayComponent()&&(o.day()>n.end.get("weekday")?o=o.day(n.end.get("weekday")+7):o=o.day(n.end.get("weekday")),n.end.imply("day",o.date()),n.end.imply("month",o.month()+1),n.end.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)}))),n.start.isDateWithUnknownYear()&&o.isAfter(n.start.dayjs()))for(let i=0;i<3&&o.isAfter(n.start.dayjs());i++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),r}};var sH=class extends Wne{constructor(e){super(),this.strictMode=e}isValid(e,r){return r.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${r.text}'`)}),!1):r.start.isValidDate()?r.end&&!r.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,r):!0:(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.start})`)}),!1)}isStrictModeValid(e,r){return r.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${r} (${r.end})`)}),!1):r.start.isOnlyTime()&&(!r.start.isCertain("hour")||!r.start.isCertain("minute"))?(e.debug(()=>{console.log(`(Strict) Removing uncertain time component: ${r} (${r.end})`)}),!1):!0}};var qrn=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"),Urn=1,zrn=2,Hrn=3,wRt=4,Vrn=5,SRt=6,xRt=7,Wrn=8,CRt=9,ORt=10,uH=class extends jo{innerPattern(){return qrn}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[Urn]),month:parseInt(r[zrn]),day:parseInt(r[Hrn])});if(r[wRt]!=null&&(n.assign("hour",parseInt(r[wRt])),n.assign("minute",parseInt(r[Vrn])),r[SRt]!=null&&n.assign("second",parseInt(r[SRt])),r[xRt]!=null&&n.assign("millisecond",parseInt(r[xRt])),r[Wrn]!=null)){let o=0;if(r[CRt]){let i=parseInt(r[CRt]),a=0;r[ORt]!=null&&(a=parseInt(r[ORt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var lH=class extends ym{mergeResults(e,r,n){let o=n.clone();return o.index=r.index,o.text=r.text+e+o.text,o.start.assign("weekday",r.start.get("weekday")),o.end&&o.end.assign("weekday",r.start.get("weekday")),o}shouldMergeResults(e,r,n){return r.start.isOnlyWeekdayComponent()&&!r.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}};function ERt(t,e=!1){return t.parsers.unshift(new uH),t.refiners.unshift(new lH),t.refiners.unshift(new iH),t.refiners.unshift(new YT),t.refiners.push(new oH),t.refiners.push(new YT),t.refiners.push(new aH),t.refiners.push(new sH(e)),t}var BRt=B(UT(),1);var t$=B(UT(),1);function PRt(t){let e=(0,t$.default)(t.instant),r=new en(t,{});return Kg(r,e),$ne(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function TRt(t){let e=(0,t$.default)(t.instant),r=new en(t,{});return Kg(r,e),YB(r,e),r.addTag("casualReference/today"),r}function MRt(t){return Jrn(t,1).addTag("casualReference/yesterday")}function Jrn(t,e){return RRt(t,-e)}function ARt(t){return RRt(t,1).addTag("casualReference/tomorrow")}function RRt(t,e){let r=(0,t$.default)(t.instant),n=new en(t,{});return r=r.add(e,"day"),Kg(n,r),YB(n,r),n}function IRt(t,e=22){let r=(0,t$.default)(t.instant),n=new en(t,{});return Kg(n,r),n.imply("hour",e),n.imply("meridiem",jn.PM),n.addTag("casualReference/tonight"),n}function DRt(t,e=20){let r=new en(t,{});return r.imply("meridiem",jn.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function jRt(t){let e=new en(t,{}),r=(0,t$.default)(t.instant);return r.hour()>2&&rRt(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function NRt(t,e=6){let r=new en(t,{});return r.imply("meridiem",jn.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function LRt(t,e=15){let r=new en(t,{});return r.imply("meridiem",jn.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function FRt(t){let e=new en(t,{});return e.imply("meridiem",jn.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var Grn=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,cH=class extends jo{innerPattern(e){return Grn}innerExtract(e,r){let n=(0,BRt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=PRt(e.reference);break;case"today":i=TRt(e.reference);break;case"yesterday":i=MRt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=ARt(e.reference);break;case"tonight":i=IRt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),Kg(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var Krn=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,dH=class extends jo{innerPattern(){return Krn}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=LRt(e.reference);break;case"evening":case"night":n=DRt(e.reference);break;case"midnight":n=jRt(e.reference);break;case"morning":n=NRt(e.reference);break;case"noon":case"midday":n=FRt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function $Rt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=Yrn(n,e,r),i=new en(t);return i=bRt(i,{day:o}),i.assign("weekday",e),i}function Yrn(t,e,r){let n=t.getDay();switch(r){case"this":return Jne(t,e);case"last":return qRt(t,e);case"next":return n==ku.SUNDAY?e==ku.SUNDAY?7:e:n==ku.SATURDAY?e==ku.SATURDAY?7:e==ku.SUNDAY?8:1+e:e<n&&e!=ku.SUNDAY?Jne(t,e):Jne(t,e)+7}return Xrn(t,e)}function Xrn(t,e){let r=qRt(t,e),n=Jne(t,e);return n<-r?n:r}function Jne(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function qRt(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var Zrn=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${xc(FPe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Qrn=1,enn=2,tnn=3,fH=class extends jo{innerPattern(){return Zrn}innerExtract(e,r){let n=r[enn].toLowerCase(),o=FPe[n],i=r[Qrn],a=r[tnn],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"),$Rt(e.reference,o,u)}};var URt=B(UT(),1);var rnn=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${xc(H8)})(?=\\s*)(?=\\W|$)`,"i"),nnn=1,onn=2,pH=class extends jo{innerPattern(){return rnn}innerExtract(e,r){let n=r[nnn].toLowerCase(),o=r[onn].toLowerCase(),i=H8[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,en.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,en.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,URt.default)(e.reference.instant);return o.match(/week/i)?(s=s.add(-s.get("d"),"d"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.imply("year",s.year())):o.match(/month/i)?(s=s.add(-s.date()+1,"d"),a.imply("day",s.date()),a.assign("year",s.year()),a.assign("month",s.month()+1)):o.match(/year/i)&&(s=s.add(-s.date()+1,"d"),s=s.add(-s.month(),"month"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.assign("year",s.year())),a}};var inn=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"),ann=1,snn=5,zRt=2,HRt=3,UPe=4,hH=class{constructor(e){this.groupNumberMonth=e?HRt:zRt,this.groupNumberDay=e?zRt:HRt}pattern(){return inn}extract(e,r){let n=r.index+r[ann].length,o=r.index+r[0].length-r[snn].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||o<e.text.length&&e.text.substring(o).match("^/?\\d"))return;let i=e.text.substring(n,o);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!r[UPe]&&i.indexOf("/")<0)return;let a=e.createParsingResult(n,i),s=parseInt(r[this.groupNumberMonth]),u=parseInt(r[this.groupNumberDay]);if((s<1||s>12)&&s>12)if(u>=1&&u<=12&&s<=31)[u,s]=[s,u];else return null;if(u<1||u>31)return null;if(a.start.assign("day",u),a.start.assign("month",s),r[UPe]){let l=parseInt(r[UPe]),c=Une(l);a.start.assign("year",c)}else{let l=VT(e.refDate,u,s);a.start.imply("year",l)}return a}};var unn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${mO})(?=\\W|$)`,"i"),lnn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${GT})(?=\\W|$)`,"i"),mH=class extends jo{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?unn:lnn}innerExtract(e,r){let n=r[1].toLowerCase(),o=gm(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=KT(o);break}return en.createRelativeFromReference(e.reference,o)}};function cnn(t){return t.text.match(/^[+-]/i)!=null}function VRt(t){return t.text.match(/^-/i)!=null}var gH=class extends ym{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?cnn(n)||VRt(n):!1}mergeResults(e,r,n,o){let i=gm(n.text);VRt(n)&&(i=KT(i));let a=en.createRelativeFromReference(new HT(r.start.date()),i);return new Yg(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function WRt(t){return t.text.match(/\s+(before|from)$/i)!=null}function dnn(t){return t.text.match(/\s+(after|since)$/i)!=null}var yH=class extends ym{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!WRt(r)&&!dnn(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=gm(r.text);WRt(r)&&(o=KT(o));let i=en.createRelativeFromReference(new HT(n.start.date()),o);return new Yg(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var fnn=new RegExp(`^\\s*(${WT})`,"i"),pnn=1,bH=class{refine(e,r){return r.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let o=e.text.substring(n.index+n.text.length),i=fnn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=JT(i[pnn]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var mD=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new cH),r.parsers.push(new dH),r.parsers.push(new G8),r.parsers.push(new pH),r.parsers.push(new mH),r}createConfiguration(e=!0,r=!1){let n=ERt({parsers:[new hH(r),new V8(e),new W8,new J8(r),new fH,new Y8,new Z8(e),new Q8(e),new eH(e)],refiners:[new e$]},e);return n.parsers.unshift(new K8(e)),n.refiners.unshift(new yH),n.refiners.unshift(new gH),n.refiners.unshift(new YT),n.refiners.push(new e$),n.refiners.push(new bH),n.refiners.push(new rH),n}};var gO=class{constructor(e){this.defaultConfig=new mD,e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new gO({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,r,n){let o=this.parse(e,r,n);return o.length>0?o[0].start.date():null}parse(e,r,n){let o=new zPe(e,r,n),i=[];return this.parsers.forEach(a=>{let s=gO.executeParser(o,a);i=i.concat(s)}),i.sort((a,s)=>a.index-s.index),this.refiners.forEach(function(a){i=a.refine(o,i)}),i}static executeParser(e,r){let n=[],o=r.pattern(e),i=e.text,a=e.text,s=o.exec(a);for(;s;){let u=s.index+i.length-a.length;s.index=u;let l=r.extract(e,s);if(!l){a=i.substring(s.index+1),s=o.exec(a);continue}let c=null;l instanceof Yg?c=l:l instanceof en?(c=e.createParsingResult(s.index,s[0]),c.start=l):c=e.createParsingResult(s.index,s[0],l);let d=c.index,f=c.text;e.debug(()=>console.log(`${r.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(c),a=i.substring(d+f.length),s=o.exec(a)}return n}},zPe=class{constructor(e,r,n){this.text=e,this.reference=new HT(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof en?e:new en(this.reference,e)}createParsingResult(e,r,n,o){let i=typeof r=="string"?r:this.text.substring(e,r),a=n?this.createParsingComponents(n):null,s=o?this.createParsingComponents(o):null;return new Yg(this.reference,e,i,a,s)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}};var HPe=new mD,JRt=new gO(HPe.createCasualConfiguration(!1)),hnn=new gO(HPe.createConfiguration(!0,!1)),wjo=new gO(HPe.createCasualConfiguration(!0));var gnn=JRt;function VPe(t,e,r){return gnn.parse(t,e,r)}var yO=class extends Error{},Gne=class extends yO{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Kne=class extends yO{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Yne=class extends yO{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Xg=class extends yO{},r$=class extends yO{constructor(e){super(`Invalid unit ${e}`)}},Ja=class extends yO{},Zg=class extends yO{constructor(){super("Zone is an abstract class")}};var Ve="numeric",Qg="short",Vp="long",XT={year:Ve,month:Ve,day:Ve},_H={year:Ve,month:Qg,day:Ve},WPe={year:Ve,month:Qg,day:Ve,weekday:Qg},vH={year:Ve,month:Vp,day:Ve},wH={year:Ve,month:Vp,day:Ve,weekday:Vp},SH={hour:Ve,minute:Ve},xH={hour:Ve,minute:Ve,second:Ve},CH={hour:Ve,minute:Ve,second:Ve,timeZoneName:Qg},OH={hour:Ve,minute:Ve,second:Ve,timeZoneName:Vp},EH={hour:Ve,minute:Ve,hourCycle:"h23"},PH={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23"},TH={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23",timeZoneName:Qg},MH={hour:Ve,minute:Ve,second:Ve,hourCycle:"h23",timeZoneName:Vp},AH={year:Ve,month:Ve,day:Ve,hour:Ve,minute:Ve},RH={year:Ve,month:Ve,day:Ve,hour:Ve,minute:Ve,second:Ve},IH={year:Ve,month:Qg,day:Ve,hour:Ve,minute:Ve},DH={year:Ve,month:Qg,day:Ve,hour:Ve,minute:Ve,second:Ve},JPe={year:Ve,month:Qg,day:Ve,weekday:Qg,hour:Ve,minute:Ve},jH={year:Ve,month:Vp,day:Ve,hour:Ve,minute:Ve,timeZoneName:Qg},NH={year:Ve,month:Vp,day:Ve,hour:Ve,minute:Ve,second:Ve,timeZoneName:Qg},LH={year:Ve,month:Vp,day:Ve,weekday:Vp,hour:Ve,minute:Ve,timeZoneName:Vp},FH={year:Ve,month:Vp,day:Ve,weekday:Vp,hour:Ve,minute:Ve,second:Ve,timeZoneName:Vp};var Kf=class{get type(){throw new Zg}get name(){throw new Zg}get ianaName(){return this.name}get isUniversal(){throw new Zg}offsetName(e,r){throw new Zg}formatOffset(e,r){throw new Zg}offset(e){throw new Zg}equals(e){throw new Zg}get isValid(){throw new Zg}};var GPe=null,wS=class extends Kf{static get instance(){return GPe===null&&(GPe=new wS),GPe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Zne(e,r,n)}formatOffset(e,r){return ZT(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var eoe={};function bnn(t){return eoe[t]||(eoe[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),eoe[t]}var _nn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function vnn(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,o,i,a,s,u,l,c]=n;return[a,o,i,s,u,l,c]}function wnn(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=_nn[i];i==="era"?n[s]=a:jt(s)||(n[s]=parseInt(a,10))}return n}var Qne={},ul=class extends Kf{static create(e){return Qne[e]||(Qne[e]=new ul(e)),Qne[e]}static resetCache(){Qne={},eoe={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=ul.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Zne(e,r,n,this.name)}formatOffset(e,r){return ZT(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=bnn(this.name),[o,i,a,s,u,l,c]=n.formatToParts?wnn(n,r):vnn(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=n$({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var GRt={};function Snn(t,e={}){let r=JSON.stringify([t,e]),n=GRt[r];return n||(n=new Intl.ListFormat(t,e),GRt[r]=n),n}var KPe={};function YPe(t,e={}){let r=JSON.stringify([t,e]),n=KPe[r];return n||(n=new Intl.DateTimeFormat(t,e),KPe[r]=n),n}var XPe={};function xnn(t,e={}){let r=JSON.stringify([t,e]),n=XPe[r];return n||(n=new Intl.NumberFormat(t,e),XPe[r]=n),n}var ZPe={};function Cnn(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=ZPe[o];return i||(i=new Intl.RelativeTimeFormat(t,e),ZPe[o]=i),i}var kH=null;function Onn(){return kH||(kH=new Intl.DateTimeFormat().resolvedOptions().locale,kH)}var KRt={};function Enn(t){let e=KRt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,KRt[t]=e}return e}function Pnn(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,o;try{n=YPe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=YPe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function Tnn(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Mnn(t){let e=[];for(let r=1;r<=12;r++){let n=st.utc(2009,r,1);e.push(t(n))}return e}function Ann(t){let e=[];for(let r=1;r<=7;r++){let n=st.utc(2016,11,13+r);e.push(t(n))}return e}function toe(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Rnn(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var QPe=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:o,floor:i,...a}=n;if(!r||Object.keys(a).length>0){let s={useGrouping:!1,...n};n.padTo>0&&(s.minimumIntegerDigits=n.padTo),this.inf=xnn(e,s)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):o$(e,3);return Ca(r,this.padTo)}}},eTe=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),s=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&ul.create(s).valid?(o=s,this.dt=e):(o="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,o=e.zone.name):(o="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||o,this.dtf=YPe(r,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},tTe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&roe()&&(this.rtf=Cnn(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):YRt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Inn={firstDay:1,minimalDays:4,weekend:[6,7]},tn=class{static fromOpts(e){return tn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||go.defaultLocale,s=a||(i?"en-US":Onn()),u=r||go.defaultNumberingSystem,l=n||go.defaultOutputCalendar,c=BH(o)||go.defaultWeekSettings;return new tn(s,u,l,c,a)}static resetCache(){kH=null,KPe={},XPe={},ZPe={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:o}={}){return tn.create(e,r,n,o)}constructor(e,r,n,o,i){let[a,s,u]=Pnn(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=Tnn(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=Rnn(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:tn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,BH(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return toe(this,e,rTe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Mnn(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return toe(this,e,nTe,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},o=r?"format":"standalone";return this.weekdaysCache[o][e]||(this.weekdaysCache[o][e]=Ann(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return toe(this,void 0,()=>oTe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[st.utc(2016,11,13,9),st.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return toe(this,e,iTe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[st.utc(-40,1,1),st.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let o=this.dtFormatter(e,r),i=o.formatToParts(),a=i.find(s=>s.type.toLowerCase()===n);return a?a.value:null}numberFormatter(e={}){return new QPe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new eTe(e,this.intl,r)}relFormatter(e={}){return new tTe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Snn(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:noe()?Enn(this.locale):Inn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};var sTe=null,Oa=class extends Kf{static get utcInstance(){return sTe===null&&(sTe=new Oa(0)),sTe}static instance(e){return e===0?Oa.utcInstance:new Oa(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new Oa(gD(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ZT(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ZT(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return ZT(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var i$=class extends Kf{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function ey(t,e){let r;if(jt(t)||t===null)return e;if(t instanceof Kf)return t;if(XRt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?wS.instance:n==="utc"||n==="gmt"?Oa.utcInstance:Oa.parseSpecifier(n)||ul.create(t)}else return ty(t)?Oa.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new i$(t)}var uTe={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"},ZRt={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]},Dnn=uTe.hanidec.replace(/[\[|\]]/g,"").split("");function QRt(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(uTe.hanidec)!==-1)e+=Dnn.indexOf(t[r]);else for(let o in ZRt){let[i,a]=ZRt[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var a$={};function eIt(){a$={}}function bm({numberingSystem:t},e=""){let r=t||"latn";return a$[r]||(a$[r]={}),a$[r][e]||(a$[r][e]=new RegExp(`${uTe[r]}${e}`)),a$[r][e]}var tIt=()=>Date.now(),rIt="system",nIt=null,oIt=null,iIt=null,aIt=60,sIt,uIt=null,go=class{static get now(){return tIt}static set now(e){tIt=e}static set defaultZone(e){rIt=e}static get defaultZone(){return ey(rIt,wS.instance)}static get defaultLocale(){return nIt}static set defaultLocale(e){nIt=e}static get defaultNumberingSystem(){return oIt}static set defaultNumberingSystem(e){oIt=e}static get defaultOutputCalendar(){return iIt}static set defaultOutputCalendar(e){iIt=e}static get defaultWeekSettings(){return uIt}static set defaultWeekSettings(e){uIt=BH(e)}static get twoDigitCutoffYear(){return aIt}static set twoDigitCutoffYear(e){aIt=e%100}static get throwOnInvalid(){return sIt}static set throwOnInvalid(e){sIt=e}static resetCaches(){tn.resetCache(),ul.resetCache(),st.resetCache(),eIt()}};var $l=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var lIt=[0,31,59,90,120,151,181,212,243,273,304,334],cIt=[0,31,60,91,121,152,182,213,244,274,305,335];function _m(t,e){return new $l("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function ooe(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let o=n.getUTCDay();return o===0?7:o}function dIt(t,e,r){return r+(bD(t)?cIt:lIt)[e-1]}function fIt(t,e){let r=bD(t)?cIt:lIt,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function ioe(t,e){return(t-e+7)%7+1}function $H(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=dIt(n,o,i),s=ioe(ooe(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=yD(l,e,r)):u>yD(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...UH(t)}}function lTe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=ioe(ooe(n,1,e),r),s=QT(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=QT(l)):u>s?(l=n+1,u-=QT(n)):l=n;let{month:c,day:d}=fIt(l,u);return{year:l,month:c,day:d,...UH(t)}}function aoe(t){let{year:e,month:r,day:n}=t,o=dIt(e,r,n);return{year:e,ordinal:o,...UH(t)}}function cTe(t){let{year:e,ordinal:r}=t,{month:n,day:o}=fIt(e,r);return{year:e,month:n,day:o,...UH(t)}}function dTe(t,e){if(!jt(t.localWeekday)||!jt(t.localWeekNumber)||!jt(t.localWeekYear)){if(!jt(t.weekday)||!jt(t.weekNumber)||!jt(t.weekYear))throw new Xg("Cannot mix locale-based week fields with ISO-based week fields");return jt(t.localWeekday)||(t.weekday=t.localWeekday),jt(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),jt(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function pIt(t,e=4,r=1){let n=qH(t.weekYear),o=Wp(t.weekNumber,1,yD(t.weekYear,e,r)),i=Wp(t.weekday,1,7);return n?o?i?!1:_m("weekday",t.weekday):_m("week",t.weekNumber):_m("weekYear",t.weekYear)}function hIt(t){let e=qH(t.year),r=Wp(t.ordinal,1,QT(t.year));return e?r?!1:_m("ordinal",t.ordinal):_m("year",t.year)}function fTe(t){let e=qH(t.year),r=Wp(t.month,1,12),n=Wp(t.day,1,s$(t.year,t.month));return e?r?n?!1:_m("day",t.day):_m("month",t.month):_m("year",t.year)}function pTe(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Wp(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Wp(r,0,59),s=Wp(n,0,59),u=Wp(o,0,999);return i?a?s?u?!1:_m("millisecond",o):_m("second",n):_m("minute",r):_m("hour",e)}function jt(t){return typeof t>"u"}function ty(t){return typeof t=="number"}function qH(t){return typeof t=="number"&&t%1===0}function XRt(t){return typeof t=="string"}function gIt(t){return Object.prototype.toString.call(t)==="[object Date]"}function roe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function noe(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function yIt(t){return Array.isArray(t)?t:[t]}function hTe(t,e,r){if(t.length!==0)return t.reduce((n,o)=>{let i=[e(o),o];return n&&r(n[0],i[0])===n[0]?n:i},null)[1]}function bIt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function eM(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function BH(t){if(t==null)return null;if(typeof t!="object")throw new Ja("Week settings must be an object");if(!Wp(t.firstDay,1,7)||!Wp(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Wp(e,1,7)))throw new Ja("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Wp(t,e,r){return qH(t)&&t>=e&&t<=r}function jnn(t,e){return t-e*Math.floor(t/e)}function Ca(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function bO(t){if(!(jt(t)||t===null||t===""))return parseInt(t,10)}function tM(t){if(!(jt(t)||t===null||t===""))return parseFloat(t)}function zH(t){if(!(jt(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function o$(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function bD(t){return t%4===0&&(t%100!==0||t%400===0)}function QT(t){return bD(t)?366:365}function s$(t,e){let r=jnn(e-1,12)+1,n=t+(e-r)/12;return r===2?bD(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function n$(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function mIt(t,e,r){return-ioe(ooe(t,1,e),r)+e-1}function yD(t,e=4,r=1){let n=mIt(t,e,r),o=mIt(t+1,e,r);return(QT(t)-n+o)/7}function HH(t){return t>99?t:t>go.twoDigitCutoffYear?1900+t:2e3+t}function Zne(t,e,r,n=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);let a={timeZoneName:e,...i},s=new Intl.DateTimeFormat(r,a).formatToParts(o).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function gD(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,o=r<0||Object.is(r,-0)?-n:n;return r*60+o}function mTe(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ja(`Invalid unit value ${t}`);return e}function u$(t,e){let r={};for(let n in t)if(eM(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=mTe(o)}return r}function ZT(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${Ca(r,2)}:${Ca(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ca(r,2)}${Ca(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function UH(t){return bIt(t,["hour","minute","second","millisecond"])}var Nnn=["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"],Lnn=["J","F","M","A","M","J","J","A","S","O","N","D"];function rTe(t){switch(t){case"narrow":return[...Lnn];case"short":return[...gTe];case"long":return[...Nnn];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 yTe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],bTe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Fnn=["M","T","W","T","F","S","S"];function nTe(t){switch(t){case"narrow":return[...Fnn];case"short":return[...bTe];case"long":return[...yTe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var oTe=["AM","PM"],knn=["Before Christ","Anno Domini"],Bnn=["BC","AD"],$nn=["B","A"];function iTe(t){switch(t){case"narrow":return[...$nn];case"short":return[...Bnn];case"long":return[...knn];default:return null}}function _It(t){return oTe[t.hour<12?0:1]}function vIt(t,e){return nTe(e)[t.weekday-1]}function wIt(t,e){return rTe(e)[t.month-1]}function SIt(t,e){return iTe(e)[t.year<0?0:1]}function YRt(t,e,r="always",n=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&i){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${o[t][0]}`;case-1:return d?"yesterday":`last ${o[t][0]}`;case 0:return d?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,s=Math.abs(e),u=s===1,l=o[t],c=n?u?l[1]:l[2]||l[1]:u?o[t][0]:t;return a?`${s} ${c} ago`:`in ${s} ${c}`}function xIt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var qnn={D:XT,DD:_H,DDD:vH,DDDD:wH,t:SH,tt:xH,ttt:CH,tttt:OH,T:EH,TT:PH,TTT:TH,TTTT:MH,f:AH,ff:IH,fff:jH,ffff:LH,F:RH,FF:DH,FFF:NH,FFFF:FH},Ea=class{static create(e,r={}){return new Ea(e,r)}static parseFormat(e){let r=null,n="",o=!1,i=[];for(let a=0;a<e.length;a++){let s=e.charAt(a);s==="'"?(n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),r=null,n="",o=!o):o||s===r?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return qnn[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return Ca(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,h)=>this.loc.extract(e,p,h),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?_It(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,h)=>n?wIt(e,p):i(h?{month:p}:{month:p,day:"numeric"},"month"),l=(p,h)=>n?vIt(e,p):i(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let h=Ea.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},d=p=>n?SIt(e,p):i({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return s();case"d":return o?i({day:"numeric"},"day"):this.num(e.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return o?i({month:"numeric"},"month"):this.num(e.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return o?i({year:"numeric"},"year"):this.num(e.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(p)}};return xIt(Ea.parseFormat(r),f)}formatDurationFromString(e,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=u=>l=>{let c=n(l);return c?this.num(u.get(c),l.length):l},i=Ea.parseFormat(r),a=i.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=e.shiftTo(...a.map(n).filter(u=>u));return xIt(i,o(s))}};var OIt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function c$(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function d$(...t){return e=>t.reduce(([r,n,o],i)=>{let[a,s,u]=i(e,o);return[{...r,...a},s||n,u]},[{},null,1]).slice(0,2)}function f$(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let o=r.exec(t);if(o)return n(o)}return[null,null]}function EIt(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=bO(e[r+o]);return[n,null,r+o]}}var PIt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Unn=`(?:${PIt.source}?(?:\\[(${OIt.source})\\])?)?`,_Te=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,TIt=RegExp(`${_Te.source}${Unn}`),vTe=RegExp(`(?:T${TIt.source})?`),znn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Hnn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Vnn=/(\d{4})-?(\d{3})/,Wnn=EIt("weekYear","weekNumber","weekDay"),Jnn=EIt("year","ordinal"),Gnn=/(\d{4})-(\d\d)-(\d\d)/,MIt=RegExp(`${_Te.source} ?(?:${PIt.source}|(${OIt.source}))?`),Knn=RegExp(`(?: ${MIt.source})?`);function l$(t,e,r){let n=t[e];return jt(n)?r:bO(n)}function Ynn(t,e){return[{year:l$(t,e),month:l$(t,e+1,1),day:l$(t,e+2,1)},null,e+3]}function p$(t,e){return[{hours:l$(t,e,0),minutes:l$(t,e+1,0),seconds:l$(t,e+2,0),milliseconds:zH(t[e+3])},null,e+4]}function VH(t,e){let r=!t[e]&&!t[e+1],n=gD(t[e+1],t[e+2]),o=r?null:Oa.instance(n);return[{},o,e+3]}function WH(t,e){let r=t[e]?ul.create(t[e]):null;return[{},r,e+1]}var Xnn=RegExp(`^T?${_Te.source}$`),Znn=/^-?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 Qnn(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,h=!1)=>p!==void 0&&(h||p&&c)?-p:p;return[{years:f(tM(r)),months:f(tM(n)),weeks:f(tM(o)),days:f(tM(i)),hours:f(tM(a)),minutes:f(tM(s)),seconds:f(tM(u),u==="-0"),milliseconds:f(zH(l),d)}]}var eon={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 wTe(t,e,r,n,o,i,a){let s={year:e.length===2?HH(bO(e)):bO(e),month:gTe.indexOf(r)+1,day:bO(n),hour:bO(o),minute:bO(i)};return a&&(s.second=bO(a)),t&&(s.weekday=t.length>3?yTe.indexOf(t)+1:bTe.indexOf(t)+1),s}var ton=/^(?:(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 ron(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=wTe(e,o,n,r,i,a,s),p;return u?p=eon[u]:l?p=0:p=gD(c,d),[f,new Oa(p)]}function non(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var oon=/^(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$/,ion=/^(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$/,aon=/^(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 CIt(t){let[,e,r,n,o,i,a,s]=t;return[wTe(e,o,n,r,i,a,s),Oa.utcInstance]}function son(t){let[,e,r,n,o,i,a,s]=t;return[wTe(e,s,r,n,o,i,a),Oa.utcInstance]}var uon=c$(znn,vTe),lon=c$(Hnn,vTe),con=c$(Vnn,vTe),don=c$(TIt),AIt=d$(Ynn,p$,VH,WH),fon=d$(Wnn,p$,VH,WH),pon=d$(Jnn,p$,VH,WH),hon=d$(p$,VH,WH);function RIt(t){return f$(t,[uon,AIt],[lon,fon],[con,pon],[don,hon])}function IIt(t){return f$(non(t),[ton,ron])}function DIt(t){return f$(t,[oon,CIt],[ion,CIt],[aon,son])}function jIt(t){return f$(t,[Znn,Qnn])}var mon=d$(p$);function NIt(t){return f$(t,[Xnn,mon])}var gon=c$(Gnn,Knn),yon=c$(MIt),bon=d$(p$,VH,WH);function LIt(t){return f$(t,[gon,AIt],[yon,bon])}var FIt="Invalid Duration",BIt={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}},_on={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},...BIt},vm=146097/400,h$=146097/4800,von={years:{quarters:4,months:12,weeks:vm/7,days:vm,hours:vm*24,minutes:vm*24*60,seconds:vm*24*60*60,milliseconds:vm*24*60*60*1e3},quarters:{months:3,weeks:vm/28,days:vm/4,hours:vm*24/4,minutes:vm*24*60/4,seconds:vm*24*60*60/4,milliseconds:vm*24*60*60*1e3/4},months:{weeks:h$/7,days:h$,hours:h$*24,minutes:h$*24*60,seconds:h$*24*60*60,milliseconds:h$*24*60*60*1e3},...BIt},_D=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],won=_D.slice(0).reverse();function rM(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new $r(n)}function $It(t,e){let r=e.milliseconds??0;for(let n of won.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function kIt(t,e){let r=$It(t,e)<0?-1:1;_D.reduceRight((n,o)=>{if(jt(e[o]))return n;if(n){let i=e[n]*r,a=t[o][n],s=Math.floor(i/a);e[o]+=s*r,e[n]-=s*a*r}return o},null),_D.reduce((n,o)=>{if(jt(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function Son(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var $r=class{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?von:_on;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||tn.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return $r.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Ja(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new $r({values:u$(e,$r.normalizeUnit),loc:tn.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(ty(e))return $r.fromMillis(e);if($r.isDuration(e))return e;if(typeof e=="object")return $r.fromObject(e);throw new Ja(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=jIt(e);return n?$r.fromObject(n,r):$r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=NIt(e);return n?$r.fromObject(n,r):$r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Ja("need to specify a reason the Duration is invalid");let n=e instanceof $l?e:new $l(e,r);if(go.throwOnInvalid)throw new Yne(n);return new $r({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new r$(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Ea.create(this.loc,n).formatDurationFromString(this,e):FIt}toHuman(e={}){if(!this.isValid)return FIt;let r=_D.map(n=>{let o=this.values[n];return jt(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(o)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=o$(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},st.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?$It(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=$r.fromDurationLike(e),n={};for(let o of _D)(eM(r.values,o)||eM(this.values,o))&&(n[o]=r.get(o)+this.get(o));return rM(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=$r.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=mTe(e(this.values[n],n));return rM(this,{values:r},!0)}get(e){return this[$r.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...u$(e,$r.normalizeUnit)};return rM(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:o}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:o,conversionAccuracy:n};return rM(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return kIt(this.matrix,e),rM(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Son(this.normalize().shiftToAll().toObject());return rM(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>$r.normalizeUnit(a));let r={},n={},o=this.toObject(),i;for(let a of _D)if(e.indexOf(a)>=0){i=a;let s=0;for(let l in n)s+=this.matrix[l][a]*n[l],n[l]=0;ty(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else ty(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 kIt(this.matrix,r),rM(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return rM(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,o){return n===void 0||n===0?o===void 0||o===0:n===o}for(let n of _D)if(!r(this.values[n],e.values[n]))return!1;return!0}};var m$="Invalid Interval";function xon(t,e){return!t||!t.isValid?ni.invalid("missing or invalid start"):!e||!e.isValid?ni.invalid("missing or invalid end"):e<t?ni.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var ni=class{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Ja("need to specify a reason the Interval is invalid");let n=e instanceof $l?e:new $l(e,r);if(go.throwOnInvalid)throw new Kne(n);return new ni({invalid:n})}static fromDateTimes(e,r){let n=g$(e),o=g$(r),i=xon(n,o);return i??new ni({start:n,end:o})}static after(e,r){let n=$r.fromDurationLike(r),o=g$(e);return ni.fromDateTimes(o,o.plus(n))}static before(e,r){let n=$r.fromDurationLike(r),o=g$(e);return ni.fromDateTimes(o.minus(n),o)}static fromISO(e,r){let[n,o]=(e||"").split("/",2);if(n&&o){let i,a;try{i=st.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=st.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return ni.fromDateTimes(i,s);if(a){let l=$r.fromISO(o,r);if(l.isValid)return ni.after(i,l)}else if(u){let l=$r.fromISO(n,r);if(l.isValid)return ni.before(s,l)}}return ni.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),o;return r?.useLocaleWeeks?o=this.end.reconfigure({locale:n.locale}):o=this.end,o=o.startOf(e,r),Math.floor(o.diff(n,e).get(e))+(o.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?ni.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(g$).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(ni.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=$r.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;n<this.e;){let s=this.start.plus(r.mapUnits(u=>u*o));i=+s>+this.e?this.e:s,a.push(ni.fromDateTimes(n,i)),n=i,o+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:ni.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return ni.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[o,i.union(a)]:[o.concat([i]),a]:[o,a],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,o=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),s=a.sort((u,l)=>u.time-l.time);for(let u of s)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&o.push(ni.fromDateTimes(r,u.time)),r=null);return ni.merge(o)}difference(...e){return ni.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:m$}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=XT,r={}){return this.isValid?Ea.create(this.s.loc.clone(r),e).formatInterval(this):m$}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:m$}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:m$}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:m$}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:m$}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):$r.invalid(this.invalidReason)}mapEndpoints(e){return ni.fromDateTimes(e(this.s),e(this.e))}};var _O=class{static hasDST(e=go.defaultZone){let r=st.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return ul.isValidZone(e)}static normalizeZone(e){return ey(e,go.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||tn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||tn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||tn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||tn.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||tn.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||tn.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||tn.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return tn.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return tn.create(r,null,"gregory").eras(e)}static features(){return{relative:roe(),localeWeek:noe()}}};function qIt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor($r.fromMillis(n).as("days"))}function Con(t,e,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=qIt(u,l);return(c-c%7)/7}],["days",qIt]],o={},i=t,a,s;for(let[u,l]of n)r.indexOf(u)>=0&&(a=u,o[u]=l(t,e),s=i.plus(o),s>e?(o[u]--,t=i.plus(o),t>e&&(s=t,o[u]--,t=i.plus(o))):t=s);return[t,o,s,a]}function UIt(t,e,r,n){let[o,i,a,s]=Con(t,e,r),u=e-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a<e&&(a=o.plus({[s]:1})),a!==o&&(i[s]=(i[s]||0)+u/(a-o)));let c=$r.fromObject(i,n);return l.length>0?$r.fromMillis(u,n).shiftTo(...l).plus(c):c}var Oon="missing Intl.DateTimeFormat.formatToParts support";function Po(t,e=r=>r){return{regex:t,deser:([r])=>e(QRt(r))}}var Eon=String.fromCharCode(160),VIt=`[ ${Eon}]`,WIt=new RegExp(VIt,"g");function Pon(t){return t.replace(/\./g,"\\.?").replace(WIt,VIt)}function zIt(t){return t.replace(/\./g,"").replace(WIt," ").toLowerCase()}function ry(t,e){return t===null?null:{regex:RegExp(t.map(Pon).join("|")),deser:([r])=>t.findIndex(n=>zIt(r)===zIt(n))+e}}function HIt(t,e){return{regex:t,deser:([,r,n])=>gD(r,n),groups:e}}function soe(t){return{regex:t,deser:([e])=>e}}function Ton(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mon(t,e){let r=bm(e),n=bm(e,"{2}"),o=bm(e,"{3}"),i=bm(e,"{4}"),a=bm(e,"{6}"),s=bm(e,"{1,2}"),u=bm(e,"{1,3}"),l=bm(e,"{1,6}"),c=bm(e,"{1,9}"),d=bm(e,"{2,4}"),f=bm(e,"{4,6}"),p=v=>({regex:RegExp(Ton(v.val)),deser:([g])=>g,literal:!0}),m=(v=>{if(t.literal)return p(v);switch(v.val){case"G":return ry(e.eras("short"),0);case"GG":return ry(e.eras("long"),0);case"y":return Po(l);case"yy":return Po(d,HH);case"yyyy":return Po(i);case"yyyyy":return Po(f);case"yyyyyy":return Po(a);case"M":return Po(s);case"MM":return Po(n);case"MMM":return ry(e.months("short",!0),1);case"MMMM":return ry(e.months("long",!0),1);case"L":return Po(s);case"LL":return Po(n);case"LLL":return ry(e.months("short",!1),1);case"LLLL":return ry(e.months("long",!1),1);case"d":return Po(s);case"dd":return Po(n);case"o":return Po(u);case"ooo":return Po(o);case"HH":return Po(n);case"H":return Po(s);case"hh":return Po(n);case"h":return Po(s);case"mm":return Po(n);case"m":return Po(s);case"q":return Po(s);case"qq":return Po(n);case"s":return Po(s);case"ss":return Po(n);case"S":return Po(u);case"SSS":return Po(o);case"u":return soe(c);case"uu":return soe(s);case"uuu":return Po(r);case"a":return ry(e.meridiems(),0);case"kkkk":return Po(i);case"kk":return Po(d,HH);case"W":return Po(s);case"WW":return Po(n);case"E":case"c":return Po(r);case"EEE":return ry(e.weekdays("short",!1),1);case"EEEE":return ry(e.weekdays("long",!1),1);case"ccc":return ry(e.weekdays("short",!0),1);case"cccc":return ry(e.weekdays("long",!0),1);case"Z":case"ZZ":return HIt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return HIt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return soe(/[a-z_+-/]{1,256}?/i);case" ":return soe(/[^\S\n\r]/);default:return p(v)}})(t)||{invalidReason:Oon};return m.token=t,m}var Aon={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 Ron(t,e,r){let{type:n,value:o}=t;if(n==="literal"){let u=/^\s+$/.test(o);return{literal:!u,val:u?" ":o}}let i=e[n],a=n;n==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=r.hour12?"hour12":"hour24");let s=Aon[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function Ion(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Don(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(eM(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 jon(t){let e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return jt(t.z)||(r=ul.create(t.z)),jt(t.Z)||(r||(r=new Oa(t.Z)),n=t.Z),jt(t.q)||(t.M=(t.q-1)*3+1),jt(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),jt(t.u)||(t.S=zH(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var STe=null;function Non(){return STe||(STe=st.fromMillis(1555555555555)),STe}function Lon(t,e){if(t.literal)return t;let r=Ea.macroTokenToFormatOpts(t.val),n=OTe(r,e);return n==null||n.includes(void 0)?t:n}function xTe(t,e){return Array.prototype.concat(...t.map(r=>Lon(r,e)))}var JH=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=xTe(Ea.parseFormat(r),e),this.units=this.tokens.map(n=>Mon(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=Ion(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=Don(e,this.regex,this.handlers),[o,i,a]=n?jon(n):[null,null,void 0];if(eM(n,"a")&&eM(n,"H"))throw new Xg("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:o,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function CTe(t,e,r){return new JH(t,r).explainFromTokens(e)}function JIt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=CTe(t,e,r);return[n,o,i,a]}function OTe(t,e){if(!t)return null;let n=Ea.create(e,t).dtFormatter(Non()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>Ron(a,t,i))}var ETe="Invalid DateTime",GIt=864e13;function GH(t){return new $l("unsupported zone",`the zone "${t.name}" is not supported`)}function PTe(t){return t.weekData===null&&(t.weekData=$H(t.c)),t.weekData}function TTe(t){return t.localWeekData===null&&(t.localWeekData=$H(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function vD(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new st({...r,...e,old:r})}function t1t(t,e,r){let n=t-e*60*1e3,o=r.offset(n);if(e===o)return[n,e];n-=(o-e)*60*1e3;let i=r.offset(n);return o===i?[n,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function uoe(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function coe(t,e,r){return t1t(n$(t),e,r)}function KIt(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),o=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...t.c,year:n,month:o,day:Math.min(t.c.day,s$(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=$r.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),s=n$(i),[u,l]=t1t(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function y$(t,e,r,n,o,i){let{setZone:a,zone:s}=r;if(t&&Object.keys(t).length!==0||e){let u=e||s,l=st.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return st.invalid(new $l("unparsable",`the input "${o}" can't be parsed as ${n}`))}function loe(t,e,r=!0){return t.isValid?Ea.create(tn.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function MTe(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ca(t.c.year,r?6:4),e?(n+="-",n+=Ca(t.c.month),n+="-",n+=Ca(t.c.day)):(n+=Ca(t.c.month),n+=Ca(t.c.day)),n}function YIt(t,e,r,n,o,i){let a=Ca(t.c.hour);return e?(a+=":",a+=Ca(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ca(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ca(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ca(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ca(Math.trunc(-t.o/60)),a+=":",a+=Ca(Math.trunc(-t.o%60))):(a+="+",a+=Ca(Math.trunc(t.o/60)),a+=":",a+=Ca(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var r1t={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Fon={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},kon={ordinal:1,hour:0,minute:0,second:0,millisecond:0},n1t=["year","month","day","hour","minute","second","millisecond"],Bon=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],$on=["year","ordinal","hour","minute","second","millisecond"];function qon(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new r$(t);return e}function XIt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return qon(t)}}function Uon(t){return foe[t]||(doe===void 0&&(doe=go.now()),foe[t]=t.offset(doe)),foe[t]}function ZIt(t,e){let r=ey(e.zone,go.defaultZone);if(!r.isValid)return st.invalid(GH(r));let n=tn.fromObject(e),o,i;if(jt(t.year))o=go.now();else{for(let u of n1t)jt(t[u])&&(t[u]=r1t[u]);let a=fTe(t)||pTe(t);if(a)return st.invalid(a);let s=Uon(r);[o,i]=coe(t,s,r)}return new st({ts:o,zone:r,loc:n,o:i})}function QIt(t,e,r){let n=jt(r.round)?!0:r.round,o=(a,s)=>(a=o$(a,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(a,s)),i=a=>r.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(r.unit)return o(i(r.unit),r.unit);for(let a of r.units){let s=i(a);if(Math.abs(s)>=1)return o(s,a)}return o(t>e?-0:0,r.units[r.units.length-1])}function e1t(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var doe,foe={},st=class{constructor(e){let r=e.zone||go.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new $l("invalid input"):null)||(r.isValid?null:GH(r));this.ts=jt(e.ts)?go.now():e.ts;let o=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[o,i]=[e.old.c,e.old.o];else{let s=ty(e.o)&&!e.old?e.o:r.offset(this.ts);o=uoe(this.ts,s),n=Number.isNaN(o.year)?new $l("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||tn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new st({})}static local(){let[e,r]=e1t(arguments),[n,o,i,a,s,u,l]=r;return ZIt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=e1t(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Oa.utcInstance,ZIt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=gIt(e)?e.valueOf():NaN;if(Number.isNaN(n))return st.invalid("invalid input");let o=ey(r.zone,go.defaultZone);return o.isValid?new st({ts:n,zone:o,loc:tn.fromObject(r)}):st.invalid(GH(o))}static fromMillis(e,r={}){if(ty(e))return e<-GIt||e>GIt?st.invalid("Timestamp out of range"):new st({ts:e,zone:ey(r.zone,go.defaultZone),loc:tn.fromObject(r)});throw new Ja(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(ty(e))return new st({ts:e*1e3,zone:ey(r.zone,go.defaultZone),loc:tn.fromObject(r)});throw new Ja("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=ey(r.zone,go.defaultZone);if(!n.isValid)return st.invalid(GH(n));let o=tn.fromObject(r),i=u$(e,XIt),{minDaysInFirstWeek:a,startOfWeek:s}=dTe(i,o),u=go.now(),l=jt(r.specificOffset)?n.offset(u):r.specificOffset,c=!jt(i.ordinal),d=!jt(i.year),f=!jt(i.month)||!jt(i.day),p=d||f,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new Xg("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Xg("Can't mix ordinal dates with month/day");let m=h||i.weekday&&!p,v,g,_=uoe(u,l);m?(v=Bon,g=Fon,_=$H(_,a,s)):c?(v=$on,g=kon,_=aoe(_)):(v=n1t,g=r1t);let S=!1;for(let N of v){let j=i[N];jt(j)?S?i[N]=g[N]:i[N]=_[N]:S=!0}let x=m?pIt(i,a,s):c?hIt(i):fTe(i),O=x||pTe(i);if(O)return st.invalid(O);let T=m?lTe(i,a,s):c?cTe(i):i,[E,M]=coe(T,l,n),R=new st({ts:E,zone:n,o:M,loc:o});return i.weekday&&p&&e.weekday!==R.weekday?st.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${R.toISO()}`):R.isValid?R:st.invalid(R.invalid)}static fromISO(e,r={}){let[n,o]=RIt(e);return y$(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=IIt(e);return y$(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=DIt(e);return y$(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(jt(e)||jt(r))throw new Ja("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=tn.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=JIt(a,e,r);return c?st.invalid(c):y$(s,u,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return st.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,o]=LIt(e);return y$(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Ja("need to specify a reason the DateTime is invalid");let n=e instanceof $l?e:new $l(e,r);if(go.throwOnInvalid)throw new Gne(n);return new st({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=OTe(e,tn.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return xTe(Ea.parseFormat(e),tn.fromObject(r)).map(o=>o.val).join("")}static resetCache(){doe=void 0,foe={}}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?PTe(this).weekYear:NaN}get weekNumber(){return this.isValid?PTe(this).weekNumber:NaN}get weekday(){return this.isValid?PTe(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?TTe(this).weekday:NaN}get localWeekNumber(){return this.isValid?TTe(this).weekNumber:NaN}get localWeekYear(){return this.isValid?TTe(this).weekYear:NaN}get ordinal(){return this.isValid?aoe(this.c).ordinal:NaN}get monthShort(){return this.isValid?_O.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?_O.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?_O.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?_O.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=n$(this.c),o=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-o*r),s=this.zone.offset(n-i*r);if(a===s)return[this];let u=n-a*r,l=n-s*r,c=uoe(u,a),d=uoe(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[vD(this,{ts:u}),vD(this,{ts:l})]:[this]}get isInLeapYear(){return bD(this.year)}get daysInMonth(){return s$(this.year,this.month)}get daysInYear(){return this.isValid?QT(this.year):NaN}get weeksInWeekYear(){return this.isValid?yD(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?yD(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Ea.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Oa.instance(e),r)}toLocal(){return this.setZone(go.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=ey(e,go.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(r||n){let i=e.offset(this.ts),a=this.toObject();[o]=coe(a,i,e)}return vD(this,{ts:o,zone:e})}else return st.invalid(GH(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return vD(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=u$(e,XIt),{minDaysInFirstWeek:n,startOfWeek:o}=dTe(r,this.loc),i=!jt(r.weekYear)||!jt(r.weekNumber)||!jt(r.weekday),a=!jt(r.ordinal),s=!jt(r.year),u=!jt(r.month)||!jt(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new Xg("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new Xg("Can't mix ordinal dates with month/day");let d;i?d=lTe({...$H(this.c,n,o),...r},n,o):jt(r.ordinal)?(d={...this.toObject(),...r},jt(r.day)&&(d.day=Math.min(s$(d.year,d.month),d.day))):d=cTe({...aoe(this.c),...r});let[f,p]=coe(d,this.o,this.zone);return vD(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=$r.fromDurationLike(e);return vD(this,KIt(this,r))}minus(e){if(!this.isValid)return this;let r=$r.fromDurationLike(e).negate();return vD(this,KIt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=$r.normalizeUnit(e);switch(o){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(r){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(o==="quarters"){let i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Ea.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):ETe}toLocaleString(e=XT,r={}){return this.isValid?Ea.create(this.loc.clone(r),e).formatDateTime(this):ETe}toLocaleParts(e={}){return this.isValid?Ea.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:o=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=e==="extended",s=MTe(this,a);return s+="T",s+=YIt(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?MTe(this,e==="extended"):null}toISOWeekDate(){return loe(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:o=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(o?"T":"")+YIt(this,a==="extended",r,e,n,i):null}toRFC2822(){return loe(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return loe(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?MTe(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let o="HH:mm:ss.SSS";return(r||e)&&(n&&(o+=" "),r?o+="z":e&&(o+="ZZ")),loe(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ETe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return $r.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=yIt(r).map($r.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=UIt(s,u,i,o);return a?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(st.now(),e,r)}until(e){return this.isValid?ni.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(r,n)<=o&&o<=i.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||st.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,o=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(o=e.unit,i=void 0),QIt(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?QIt(e.base||st.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(st.isDateTime))throw new Ja("min requires all arguments be DateTimes");return hTe(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(st.isDateTime))throw new Ja("max requires all arguments be DateTimes");return hTe(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=tn.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return CTe(a,e,r)}static fromStringExplain(e,r,n={}){return st.fromFormatExplain(e,r,n)}static buildFormatParser(e,r={}){let{locale:n=null,numberingSystem:o=null}=r,i=tn.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new JH(i,e)}static fromFormatParser(e,r,n={}){if(jt(e)||jt(r))throw new Ja("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=tn.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Ja(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`);let{result:s,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(e);return c?st.invalid(c):y$(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return XT}static get DATE_MED(){return _H}static get DATE_MED_WITH_WEEKDAY(){return WPe}static get DATE_FULL(){return vH}static get DATE_HUGE(){return wH}static get TIME_SIMPLE(){return SH}static get TIME_WITH_SECONDS(){return xH}static get TIME_WITH_SHORT_OFFSET(){return CH}static get TIME_WITH_LONG_OFFSET(){return OH}static get TIME_24_SIMPLE(){return EH}static get TIME_24_WITH_SECONDS(){return PH}static get TIME_24_WITH_SHORT_OFFSET(){return TH}static get TIME_24_WITH_LONG_OFFSET(){return MH}static get DATETIME_SHORT(){return AH}static get DATETIME_SHORT_WITH_SECONDS(){return RH}static get DATETIME_MED(){return IH}static get DATETIME_MED_WITH_SECONDS(){return DH}static get DATETIME_MED_WITH_WEEKDAY(){return JPe}static get DATETIME_FULL(){return jH}static get DATETIME_FULL_WITH_SECONDS(){return NH}static get DATETIME_HUGE(){return LH}static get DATETIME_HUGE_WITH_SECONDS(){return FH}};function g$(t){if(st.isDateTime(t))return t;if(t&&t.valueOf&&ty(t.valueOf()))return st.fromJSDate(t);if(t&&typeof t=="object")return st.fromObject(t);throw new Ja(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var o1t=require("obsidian");Pd();async function zon(){let t=new Date,e=t.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(t.getTime()),isoString:t.toISOString(),userLocaleString:t.toLocaleString(),localDateString:t.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-e,timezone:r}}var i1t=Lp(async()=>zon(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Pr.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 Hon(t,e){let r=t.match(/^(last|past|previous|prior)\s+(\d+)\s+(days?|weeks?|months?|years?)$/i);if(!r)return;let[,,n,o]=r,i=parseInt(n);if(i<=0)return;let a=o.replace(/s$/,""),s=e.startOf("day");return{start:s.minus({[a+"s"]:i}),end:s}}function Von(t,e){switch(t){case"yesterday":return{start:e.minus({days:1}).startOf("day"),end:e.minus({days:1}).endOf("day")};case"last week":return{start:e.minus({weeks:1}).startOf("week"),end:e.minus({weeks:1}).endOf("week")};case"this week":return{start:e.startOf("week"),end:e.endOf("week")};case"next week":return{start:e.plus({weeks:1}).startOf("week"),end:e.plus({weeks:1}).endOf("week")};case"last month":return{start:e.minus({months:1}).startOf("month"),end:e.minus({months:1}).endOf("month")};case"this month":return{start:e.startOf("month"),end:e.endOf("month")};case"next month":return{start:e.plus({months:1}).startOf("month"),end:e.plus({months:1}).endOf("month")};case"last year":return{start:e.minus({years:1}).startOf("year"),end:e.minus({years:1}).endOf("year")};case"this year":return{start:e.startOf("year"),end:e.endOf("year")};case"next year":return{start:e.plus({years:1}).startOf("year"),end:e.plus({years:1}).endOf("year")};case"last quarter":return{start:e.minus({quarters:1}).startOf("quarter"),end:e.minus({quarters:1}).endOf("quarter")};case"this quarter":return{start:e.startOf("quarter"),end:e.endOf("quarter")};case"next quarter":return{start:e.plus({quarters:1}).startOf("quarter"),end:e.plus({quarters:1}).endOf("quarter")}}}function Won(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=VPe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=st.fromJSDate(o[0].start.date()).startOf("week"),a=i.endOf("week");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Jon(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=a1t[r[1]],o=e.year;n>e.month&&o--;let i=st.fromObject({year:o,month:n,day:1}),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Gon(t,e){let r=t.match(/^(?:(?:the\s+)?(?:year|yr)(?:\s+(?:of|in))?\s+)?(\d{4})$/i);if(!r)return;let n=parseInt(r[1]),o=st.fromObject({year:n,month:1,day:1}),i=st.fromObject({year:n,month:12,day:31});return o>e&&(o=o.minus({years:1}),i=i.minus({years:1})),{start:o,end:i}}function Kon(t,e){let r=t.match(/^(?:(?:q|Q)(\d{1})\s+(\d{4})|(\d{4})\s+(?:q|Q)(\d{1}))$/),n=t.match(/^(?:q|Q)(\d{1})$/),o,i;if(r)o=parseInt(r[1]||r[4]),i=parseInt(r[2]||r[3]);else if(n){o=parseInt(n[1]),i=e.year;let l=Math.floor((e.month-1)/3)+1;o>l&&i--}else return;if(o<1||o>4)return;let a=(o-1)*3+1,s=st.fromObject({year:i,month:a,day:1}).startOf("day"),u=s.plus({months:3}).minus({days:1}).endOf("day");return s>e&&(s=s.minus({years:1}),u=u.minus({years:1})),{start:s,end:u}}function Yon(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=a1t[r[1].toLowerCase()],o=parseInt(r[2]),i=st.fromObject({year:o,month:n,day:1}).startOf("day"),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Xon(t){let e=st.now(),r=t.toLowerCase().replace("@vault","").trim(),n=Hon(r,e)||Von(r,e)||Won(r,e)||Jon(r,e)||Yon(r,e)||Kon(r,e)||Gon(r,e);if(n)return{startTime:KH(n.start),endTime:KH(n.end)};let o=VPe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=st.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?st.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:KH(i),endTime:KH(a)}}console.warn(`Unable to parse time expression: ${t}`)}function KH(t){let e=t.toJSDate(),r=e.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(o=>o.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:e.toLocaleString(),localDateString:e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-r,timezone:n}}var s1t=Lp(async({timeExpression:t})=>Xon(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Pr.object({timeExpression:Pr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function Zon(t){let e=t.toString().length===10?t*1e3:t,r=st.fromMillis(e);return KH(r)}var u1t=Lp(async({epoch:t})=>Zon(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Pr.object({epoch:Pr.number().describe("Unix timestamp in seconds or milliseconds")})});function Qon(t){let e=t.match(/^(\d+)\s*(s|sec|seconds?|m|min|minutes?|h|hr|hours?)$/i);if(!e)throw new Error(`Invalid time interval format: ${t}`);let r=parseInt(e[1],10),n=e[2].toLowerCase();switch(n){case"s":case"sec":case"second":case"seconds":return r*1e3;case"m":case"min":case"minute":case"minutes":return r*60*1e3;case"h":case"hr":case"hour":case"hours":return r*60*60*1e3;default:throw new Error(`Unsupported time unit: ${n}`)}}async function ein(t="25min"){let e=Qon(t);return new Promise(r=>{setTimeout(()=>{new o1t.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var ATe=Lp(async({interval:t="25min"})=>(ein(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Pr.object({interval:Pr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});Pd();function tin(t){return"children"in t&&"path"in t}function rin(t){return"path"in t&&!("children"in t)}function l1t(t){let e={path:t.path,children:[]};for(let r of t.children)tin(r)&&e.children?.push(l1t(r));for(let r of t.children)rin(r)&&e.children?.push({path:r.path});return e}var c1t=t=>Lp(async()=>JSON.stringify(l1t(t),null,0),{name:"getFileTree",description:"Get the complete file tree structure of the folder as JSON",schema:Pr.object({})});Pd();var RTe=Lp(async({url:t})=>{try{let e=await Sa.getInstance().youtube4llm(t);return e.response.transcript?JSON.stringify({success:!0,transcript:e.response.transcript,elapsed_time_ms:e.elapsed_time_ms}):JSON.stringify({success:!1,message:"Transcript not available. Only English videos with the auto transcript option turned on are supported at the moment"})}catch(e){return console.error(`Error transcribing YouTube video ${t}:`,e),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:Pr.object({url:Pr.string().describe("The YouTube video URL"),brevilabsClient:Pr.any().describe("The BrevilabsClient instance")})});var b$=class{},d1t=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},poe=(t,e)=>{let r=d1t(t,e);if(!r){let n=Object.keys(t);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},ITe=(t,e)=>{let r=d1t(t,e);if(!r&&r!==""){let n=Object.keys(t);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};mA();xA();var DTe=class extends zc{addUserMessage(e){return this.addMessage(new Qa(e))}addAIChatMessage(e){return this.addMessage(new To(e))}addAIMessage(e){return this.addMessage(new To(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},_$=class extends DTe{constructor(e){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","stores","message","in_memory"]}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};var SS=class extends b${constructor(e){super(),Object.defineProperty(this,"chatHistory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnMessages",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chatHistory=e?.chatHistory??new _$,this.returnMessages=e?.returnMessages??this.returnMessages,this.inputKey=e?.inputKey??this.inputKey,this.outputKey=e?.outputKey??this.outputKey}async saveContext(e,r){await this.chatHistory.addUserMessage(poe(e,this.inputKey)),await this.chatHistory.addAIChatMessage(ITe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};jTe();MA();var YH=class extends SS{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),Object.defineProperty(this,"k",{enumerable:!0,configurable:!0,writable:!0,value:5}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.k=e?.k??this.k}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r.slice(-this.k*2)}:{[this.memoryKey]:df(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};mA();jTe();var wm=class{constructor(){this.initMemory(),bl(()=>this.initMemory())}static getInstance(){return wm.instance||(wm.instance=new wm),wm.instance}initMemory(){let e=me().contextTurns;this.memory=new YH({k:e*2,memoryKey:"history",inputKey:"input",returnMessages:!0}),this.debug&&console.log("Memory initialized with context turns:",e)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let e=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",e),e}async saveContext(e,r){this.debug&&console.log("Saving to memory - Input:",e,"Output:",r),await this.memory.saveContext(e,r)}};var XH=["@vault","@web","@youtube","@pomodoro"],wD=class{static initTools(e){this.tools.length===0&&(this.tools=[i1t,u1t,s1t,PPe,eRt,ATe,TPe,RTe,c1t(e.getRoot())])}static async analyzeIntent(e){try{let r=await Sa.getInstance().broca(e);if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};u.name==="getTimeRangeMs"&&(a=await KB.callTool(u,l)),i.push({tool:u,args:l})}}return await this.processAtCommands(e,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(e,r,n){let o=e.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")&&(a.length>0||i)){let s=this.removeAtCommands(e);r.push({tool:PPe,args:{timeRange:i||void 0,query:s,salientTerms:a}})}if(o.includes("@web")){let s=this.removeAtCommands(e),l=await wm.getInstance().getMemory().loadMemoryVariables({}),c=Gj(l);r.push({tool:TPe,args:{query:s,chatHistory:c}})}if(o.includes("@pomodoro")){let s=e.match(/@pomodoro\s+(\S+)/i),u=s?s[1]:"25min";r.push({tool:ATe,args:{interval:u}})}if(o.includes("@youtube")){let s=lU(e);s&&r.push({tool:RTe,args:{url:s}})}}static removeAtCommands(e){return e.split(" ").filter(r=>!XH.includes(r.toLowerCase())).join(" ").trim()}};wD.tools=[];var ZH=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s){return e&&n.signal.reason!=="new-chat"&&(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:e}),o({message:e,sender:Iy,isVisible:!0,timestamp:ys(new Date),sources:s})),i(""),a&&(console.log(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(u=>u.content)),console.log(`==== Final AI Response ====
`,e)),e}async handleError(e,r,n,o){let i=ia(e);r&&console.error("Error during LLM invocation:",i);let a=e?.response?.data?.error||i,s=a?.code||i,u="";if(e?.message?.includes("Invalid license key")?u="Invalid Copilot Plus license key. Please check your license key in settings.":s==="model_not_found"?u="You do not have access to this model or the model does not exist, please check with your API provider.":u=`${s}`,console.error(a),n&&o){o("");let l=u.search("Troubleshooting URL");u=l!==-1?u.slice(0,l):u,i.search(/401|invalid|not valid/gi)!==-1&&(u=`Something went wrong. Please check if you have set your API key.
Path: Settings > copilot plugin > Basic Tab > Set Keys
Error Details: `+u),n({message:u,isErrorMessage:!0,sender:Iy,isVisible:!0,timestamp:ys(new Date)})}else new g1t.Notice(u),console.error(a)}},hoe=class extends ZH{async run(e,r,n,o,i){let{debug:a=!1}=i,s="";try{let l=await xS.getChain().stream({input:e.message});for await(let c of l){if(r.signal.aborted)break;s+=c.content,n(s)}}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s,e,r,o,n,a)}},moe=class extends ZH{async run(e,r,n,o,i){let{debug:a=!1}=i,s="";try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(Y5,e,r,o,n,a);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=Gj(c),f=await xS.getRetrievalChain().stream({question:e.message,chat_history:d});for await(let p of f){if(r.signal.aborted)break;s+=p.content,n(s)}s=this.addSourcestoResponse(s)}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s,e,r,o,n,a)}addSourcestoResponse(e){let r=yke(xS.retrievedDocuments);if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}},goe=class extends ZH{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=lU(r),i=r.split(/\s+/).filter(a=>a!=="@youtube"&&a.length>0);return n&&o!==null&&i.length===1}async processImageUrls(e){try{return(await Promise.all(e.map(async n=>await lx.isImageUrl(n)?await lx.convertToBase64(n,this.chainManager.app.vault):null))).filter(n=>n!==null)}catch(r){return console.error("Error processing image URLs:",r),[]}}async processExistingImages(e){try{return await Promise.all(e.filter(n=>n.type==="image_url"&&!!n.image_url?.url).map(async n=>await lx.convertToBase64(n.image_url.url,this.chainManager.app.vault)))}catch(r){throw console.error("Error processing images:",r),r}}async buildMessageContent(e,r){let n=[{type:"text",text:e}];if(r.context?.urls&&r.context.urls.length>0){let o=await this.processImageUrls(r.context.urls);n.push(...o)}if(r.content&&r.content.length>0){let o=await this.processExistingImages(r.content);n.push(...o)}return n}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}async streamMultimodalResponse(e,r,n,o,i){let s=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),u=Gj(s),l=[],c=IA();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:Cke(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,_]of u)l.push({role:"user",content:g}),l.push({role:"assistant",content:_});let f=this.chainManager.chatModelManager.getChatModel(),h=this.isMultimodalModel(f)?await this.buildMessageContent(e,r):e;l.push({role:"user",content:h}),i&&console.log(`==== Final Request to AI ====
`,l);let m="",v=await this.chainManager.chatModelManager.getChatModel().stream(l);for await(let g of v){if(n.signal.aborted)break;m+=g.content,o(m)}return m}async run(e,r,n,o,i){let{debug:a=!1,updateLoadingMessage:s}=i,u="",l=[];try{if(this.isYoutubeOnlyMessage(e.message)){let h=lU(e.message),m="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(h)try{let v=await Sa.getInstance().youtube4llm(h);return v.response.transcript?this.handleResponse(v.response.transcript,e,r,o,n,a):this.handleResponse(m,e,r,o,n,a)}catch(v){return console.error("Error processing YouTube video:",v),this.handleResponse(m,e,r,o,n,a)}}a&&console.log("==== Step 1: Analyzing intent ====");let c;try{let h=e.originalMessage||e.message;c=await wD.analyzeIntent(h)}catch(h){return this.handleResponse(fke(h),e,r,o,n,a)}let d=e.message.split(" ").filter(h=>!XH.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),v=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),g=Gj(v);a&&console.log("==== Step 3: Condensing Question ====");let _=await kne(d,g);a&&console.log("Condensed standalone question: ",_),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(_,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,e,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,e,r,n,a)}}catch(c){s?.(cx.DEFAULT),await this.handleError(c,a,o,n)}return this.handleResponse(u,e,r,o,n,a,l)}getSources(e){return!e||!Array.isArray(e)?(console.warn("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(e)}sortUniqueDocsByScore(e){let r=new Map;for(let n of e){if(!n.title||!n?.score&&!n?.rerank_score){console.warn("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r,n){let o=[];for(let i of e){r&&console.log(`==== Step 2: Calling tool: ${i.tool.name} ====`),i.tool.name==="localSearch"?n?.(cx.READING_FILES):i.tool.name==="webSearch"?n?.(cx.SEARCHING_WEB):i.tool.name==="getFileTree"&&n?.(cx.READING_FILE_TREE);let a=await KB.callTool(i.tool,i.args);o.push({tool:i.tool.name,output:a})}return o}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=`
# Additional context:
`+o.map(i=>`# ${i.tool}
${JSON.stringify(i.output)}`).join(`
`))}return`User message: ${e}${n}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>Ile){let s=Ile/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}`}};MA();var y1t=require("obsidian");MA();var CS=class{constructor(){this.initChatPrompt(),this.initQAPrompt(),bl(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return CS.instance||(CS.instance=new CS),CS.instance}initChatPrompt(){let e=this.escapeTemplateString(IA());this.chatPrompt=Vc.fromMessages([qj.fromTemplate(e),new sE("history"),uE.fromTemplate("{input}")])}initQAPrompt(){let e=`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`;this.qaPrompt=Vc.fromMessages([qj.fromTemplate(e)])}escapeTemplateString(e){return e.replace(/\{/g,"{{").replace(/\}/g,"}}")}getChatPrompt(){return this.chatPrompt}async getQAPrompt({question:e,context:r,systemMessage:n}){return await this.qaPrompt.format({question:e,context:r,system_message:n})}};var Sm=class{constructor(e,r){this.app=e,this.vectorStoreManager=r,this.memoryManager=wm.getInstance(),this.chatModelManager=Eo.getInstance(),this.promptManager=CS.getInstance(),this.initialize(),Lke(async()=>await this.createChainWithNewModel()),Fke(()=>this.setChain(eg(),{refreshIndex:me().indexVaultToVectorStore==="ON MODE SWITCH"&&(eg()==="vault_qa"||eg()==="copilot_plus")})),bl(async()=>await this.createChainWithNewModel())}async initialize(){await this.createChainWithNewModel()}static getChain(){return Sm.chain}static getRetrievalChain(){return Sm.retrievalChain}validateChainType(e){if(e==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let e="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new y1t.Notice(e),new Error(e)}}validateChainInitialization(){(!Sm.chain||!hke(Sm.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",eg()),this.setChain(eg()))}static storeRetrieverDocuments(e){Sm.retrievedDocuments=e}async createChainWithNewModel(){let e=o9();try{let r=vke(e,me().activeModels);r||(console.error("Resetting default model. No model configuration found for: ",e),r=dE[0],e=r.name+"|"+r.provider),await this.chatModelManager.setChatModel(r),this.setChain(eg()),hr(`Setting model to ${e}`)}catch(r){Mo(`createChainWithNewModel failed: ${r}`),hr(`modelKey: ${e}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{Sm.chain=K5.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Yj("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new qT({minSimilarityScore:.01,maxK:me().maxSourceChunks,salientTerms:[]});Sm.retrievalChain=K5.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:IA()},Sm.storeRetrieverDocuments.bind(Sm),me().debug),Yj("vault_qa"),me().debug&&(console.log("New Vault QA chain with hybrid retriever created for entire vault"),console.log("Set chain:","vault_qa"));break}case"copilot_plus":{await this.initializeQAChain(r),Sm.chain=K5.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Yj("copilot_plus");break}default:this.validateChainType(e);break}}getChainRunner(){let e=eg();switch(e){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: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}async runChain(e,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ====
`,e),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||jA(u)){let c=Vc.fromMessages([new sE("history"),uE.fromTemplate("{input}")]);jA(u)&&(c=Vc.fromMessages([[Ao,IA()||""],c])),this.setChain(eg(),{prompt:c})}return await this.getChainRunner().run(e,r,n,o,i)}async updateMemoryWithLoadedMessages(e){await this.memoryManager.clearChatMemory();for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];n&&o&&n.sender===Ao&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}},xS=Sm;xS.retrievedDocuments=[];function b1t(t){let e=t.split(`
`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===Ao?Ao:Iy,message:o.trim(),isVisible:!0,timestamp:i?Ele(i):null}),n=a.startsWith("**user**:")?Ao:Iy,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===Ao?Ao:Iy,message:o.trim(),isVisible:!0,timestamp:i?Ele(i):null}),r}async function QH(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Ao){let o=t[r+1];o?.sender===Iy&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}function sin(t){return`<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>${t}</text>`}function uin(t){return`<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>${t}</text>`}function lin(t){return`<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>${t}</text>`}function cin(t){return`<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>${t}</text>`}function din(t){return`<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>${t}</text>`}function fin(t){return`<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>${t}</text>`}function pin(t){return`<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>${t}</text>`}function hin(t){return`<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>${t}</text>`}function min(t){return`<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>${t}</text>`}function gin(t){return`<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>${t}</text>`}function yin(t){return`<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>${t}</text>`}function bin(t){return`<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>${t}</text>`}function _in(t){return`<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>${t}</text>`}function vin(t,e){return`<instruction>Translate the text below into ${e}:
1. Preserve the meaning and tone
2. Maintain appropriate cultural context
3. Keep formatting and structure
Return only the translated text.</instruction>
<text>${t}</text>`}function win(t,e){return`<instruction>Rewrite the text below in a ${e} tone while:
1. Keeping the original meaning
2. Adjusting word choice and phrasing
3. Preserving key information
Return only the rewritten text.</instruction>
<text>${t}</text>`}var _1t={[te.FIX_GRAMMAR]:sin,[te.SUMMARIZE]:uin,[te.GENERATE_TOC]:lin,[te.GENERATE_GLOSSARY]:cin,[te.SIMPLIFY]:din,[te.EMOJIFY]:fin,[te.REMOVE_URLS]:pin,[te.REWRITE_TWEET]:hin,[te.REWRITE_TWEET_THREAD]:min,[te.MAKE_SHORTER]:gin,[te.MAKE_LONGER]:yin,[te.ELI5]:bin,[te.PRESS_RELEASE]:_in,[te.TRANSLATE]:vin,[te.CHANGE_TONE]:win};var v$=require("obsidian"),gr=B(Z()),v1t=B(lg());var yoe=B(Z());var Ii=yoe.forwardRef(({className:t,type:e,...r},n)=>yoe.createElement("input",{type:e,className:Te("!h-9 !min-w-[50px] !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",t),ref:n,...r}));Ii.displayName="Input";var xm=B(Z());var e6=xm.forwardRef(({className:t,value:e,...r},n)=>{let o=xm.useRef(null),i=xm.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);xm.useLayoutEffect(()=>{i()},[e,i]),xm.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 xm.createElement("textarea",{className:Te("border-solid resize-y min-w-fit overflow-auto","flex min-h-[60px] max-h-[300px] w-full rounded-md border border-primary-alt bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),value:e,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});e6.displayName="Textarea";function Sin({initialTitle:t="",initialPrompt:e="",disabledTitle:r=!1,onSave:n,onCancel:o}){let[i,a]=(0,gr.useState)(t),[s,u]=(0,gr.useState)(e),[l,c]=(0,gr.useState)({title:!1,prompt:!1}),[d,f]=(0,gr.useState)(!1),h=i&&/[<>:"/\\|?*\x00-\x1F]/g.test(i),m=async()=>{if(h){new v$.Notice("Title contains invalid characters. Please remove them before saving.");return}if(i&&s)try{f(!0),await n(i,s)}catch(S){new v$.Notice(ia(S))}finally{f(!1)}else c({title:!0,prompt:!0}),new v$.Notice("Please fill in both fields: Title and Prompt.")},v=l.title&&!i,g=l.prompt&&!s,_=i.trim()!==""&&s.trim()!==""&&!h;return gr.default.createElement("div",{className:"flex flex-col gap-4 p-4"},gr.default.createElement("div",{className:"text-xl font-bold text-normal mb-2"},"User Custom Prompt"),gr.default.createElement("div",{className:"flex flex-col"},gr.default.createElement("div",{className:"flex items-center gap-1"},gr.default.createElement("div",{className:"text-base font-medium text-normal"},"Title"),gr.default.createElement("span",{className:"text-error"},"*")),gr.default.createElement("div",{className:"flex flex-col gap-1"},gr.default.createElement("div",{className:"text-sm text-muted"},"The title of the prompt, must be unique."),gr.default.createElement("div",{className:"text-xs text-warning"},"Note: Title will be used as filename. Avoid using: ",'< > : " / \\ | ? *')),gr.default.createElement(Ii,{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}),v&&gr.default.createElement("div",{className:"text-error text-xs mt-1"},"Title is required"),h&&gr.default.createElement("div",{className:"text-error text-xs mt-1"},"Title contains invalid characters")),gr.default.createElement("div",{className:"flex flex-col gap-1"},gr.default.createElement("div",{className:"space-y-2"},gr.default.createElement("div",{className:"flex items-center gap-1"},gr.default.createElement("div",{className:"text-base font-medium text-normal"},"Prompt"),gr.default.createElement("span",{className:"text-error"},"*")),gr.default.createElement("div",{className:"text-sm text-muted -mt-1"},"Use the following syntax in your prompt:")),gr.default.createElement("div",{className:"text-sm flex flex-col gap-1 bg-secondary/30 rounded-md p-2"},gr.default.createElement("strong",null,"- ","{}"," represents the selected text (not required). "),gr.default.createElement("strong",null,"- ","{[[Note Title]]}"," represents a note. "),gr.default.createElement("strong",null,"- ","{activeNote}"," represents the active note. "),gr.default.createElement("strong",null,"- ","{FolderPath}"," represents a folder of notes. "),gr.default.createElement("strong",null,"- ","{#tag1, #tag2}"," represents ALL notes with ANY of the specified tags in their property (an OR operation)."," "),gr.default.createElement("div",{className:"mt-1"},gr.default.createElement("span",{className:"text-muted"},"Tip: turn on debug mode to show the processed prompt in the chat window."))),gr.default.createElement(e6,{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&&gr.default.createElement("div",{className:"text-error text-xs mt-1"},"Prompt is required"),gr.default.createElement("div",{className:"flex flex-col text-xs text-muted gap-2 mt-2"},gr.default.createElement("div",null,"Save the prompt to the local prompt library. You can then use it with the Copilot command: ",gr.default.createElement("strong",null,"Apply custom prompt to selection.")),gr.default.createElement("div",null,"Check out the"," ",gr.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."))),gr.default.createElement("div",{className:"flex items-center justify-end gap-2"},gr.default.createElement(Ge,{variant:"secondary",onClick:o,disabled:d},"Cancel"),gr.default.createElement(Ge,{onClick:m,disabled:!_||d},d?"Saving...":"Save")))}var t6=class extends v$.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,v1t.createRoot)(r);let n=async(i,a)=>{await this.onSave(i,a),this.close()},o=()=>{this.close()};this.root.render(gr.default.createElement(Sin,{initialTitle:this.initialTitle,initialPrompt:this.initialPrompt,disabledTitle:this.disabledTitle,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};var w1t=require("obsidian"),boe=class extends w1t.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 nM=require("obsidian"),_oe=class extends nM.Modal{constructor(r,n){super(r);this.plugin=n}onOpen(){let{contentEl:r}=this;r.empty(),r.createEl("h2",{text:"Debug: Search OramaDB"});let n=r.createEl("p");n.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=r.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),r.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let a=JSON.parse(this.searchInput.value);a.vector?.value&&!Array.isArray(a.vector.value)&&(a.vector.value=Object.values(a.vector.value));let s=await this.plugin.vectorStoreManager.getDb();if(!s){new nM.Notice("Database not found");return}let u=await gc(s,a),l=["## Search Parameters","```json",JSON.stringify(a,null,2),"```","","## Results",`Total hits: ${u.hits.length}`,"","### Hits","```json",JSON.stringify(u.hits,null,2),"```"].join(`
`),c="OramaDB-Debug-Search.md",d=this.app.vault.getAbstractFileByPath(c);d instanceof nM.TFile?await this.app.vault.modify(d,l):await this.app.vault.create(c,l);let f=this.app.vault.getAbstractFileByPath(c);f instanceof nM.TFile&&(await this.app.workspace.getLeaf().openFile(f),this.close())}catch(a){console.error("Error in debug search:",a),new nM.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:r}=this;r.empty()}};var woe=require("obsidian"),cs=B(Z()),S1t=B(lg());function xin({originalText:t,promptMessage:e,chainManager:r,commandId:n,onInsert:o,onReplace:i,onClose:a}){let[s,u]=(0,cs.useState)(null),[l,c]=(0,cs.useState)(null),d=Dy[n],f=(0,cs.useCallback)(p=>{c(p.message)},[]);return(0,cs.useEffect)(()=>{let p=new AbortController;async function h(){let m="",v=await Eo.getInstance().getChatModel().stream(e.message);for await(let g of v){if(p?.signal.aborted)break;m+=g.content,u(m)}p?.signal.aborted||c(m)}return h(),()=>{p.abort()}},[e,r,f]),cs.default.createElement("div",{className:"flex flex-col gap-4"},cs.default.createElement("div",{className:"max-h-60 overflow-y-auto text-muted whitespace-pre-wrap"},t),d&&cs.default.createElement("div",{className:"text-normal flex items-center gap-2 font-bold"},cs.default.createElement(qE,{className:"w-4 h-4"}),d),cs.default.createElement("div",{className:"relative group"},cs.default.createElement("textarea",{className:"w-full h-60 text-text peer",value:l??s??"loading...",disabled:l==null,onChange:p=>c(p.target.value)}),l&&cs.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(l),new woe.Notice("Copied to clipboard")}},cs.default.createElement(eR,{className:"w-4 h-4 text-muted-foreground hover:text-accent"}))),cs.default.createElement("div",{className:"flex justify-end gap-2"},cs.default.createElement("button",{onClick:a},"Close"),cs.default.createElement("button",{disabled:l==null,className:"!bg-interactive-accent !text-on-accent cursor-pointer",onClick:()=>o(l??"")},"Insert"),cs.default.createElement("button",{disabled:l==null,className:"!bg-interactive-accent !text-on-accent cursor-pointer",onClick:()=>i(l??"")},"Replace")))}var voe=class extends woe.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,S1t.createRoot)(r);let{selectedText:n,commandId:o,promptMessage:i,chainManager:a}=this.configs,s=c=>{cU(c),this.close()},u=c=>{cU(c,!0),this.close()},l=()=>{this.close()};this.root.render(cs.default.createElement(xin,{originalText:n,promptMessage:i,chainManager:a,commandId:o,onInsert:s,onReplace:u,onClose:l}))}onClose(){this.root.unmount()}};var x1t=require("obsidian"),Cin=[{code:"en",name:"English"},{code:"zh",name:"Chinese"},{code:"ja",name:"Japanese"},{code:"ko",name:"Korean"},{code:"es",name:"Spanish"},{code:"fr",name:"French"},{code:"de",name:"German"},{code:"it",name:"Italian"},{code:"pt",name:"Portuguese"},{code:"ru",name:"Russian"},{code:"ar",name:"Arabic"},{code:"bn",name:"Bengali"},{code:"cs",name:"Czech"},{code:"da",name:"Danish"},{code:"el",name:"Greek"},{code:"fi",name:"Finnish"},{code:"he",name:"Hebrew"},{code:"hi",name:"Hindi"},{code:"hu",name:"Hungarian"},{code:"id",name:"Indonesian"},{code:"ms",name:"Malay"},{code:"nl",name:"Dutch"},{code:"no",name:"Norwegian"},{code:"pl",name:"Polish"},{code:"sv",name:"Swedish"},{code:"th",name:"Thai"},{code:"tr",name:"Turkish"},{code:"uk",name:"Ukrainian"},{code:"vi",name:"Vietnamese"},{code:"af",name:"Afrikaans"},{code:"bg",name:"Bulgarian"},{code:"ca",name:"Catalan"},{code:"et",name:"Estonian"},{code:"fa",name:"Persian"},{code:"fil",name:"Filipino"},{code:"hr",name:"Croatian"},{code:"is",name:"Icelandic"},{code:"lt",name:"Lithuanian"},{code:"lv",name:"Latvian"},{code:"ro",name:"Romanian"},{code:"sk",name:"Slovak"},{code:"sl",name:"Slovenian"},{code:"sr",name:"Serbian"},{code:"sw",name:"Swahili"},{code:"ta",name:"Tamil"},{code:"te",name:"Telugu"},{code:"ur",name:"Urdu"},{code:"zu",name:"Zulu"},{code:"mn",name:"Mongolian"},{code:"ne",name:"Nepali"},{code:"pa",name:"Punjabi"},{code:"si",name:"Sinhala"}],Soe=class extends x1t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseLanguage=n}getItems(){return Cin}getItemText(r){return r.name}onChooseItem(r,n){this.onChooseLanguage(r.name)}};var C1t=require("obsidian"),vO=class extends C1t.FuzzySuggestModal{constructor(r,n,o,i=[]){super(r);this.promptTitles=n,this.onChoosePromptTitle=o,this.descriptions=i}getItems(){return this.promptTitles}getItemText(r){let n=this.promptTitles.indexOf(r),o=this.descriptions[n];return o?`${r} - ${o}`:r}onChooseItem(r,n){let o=r.split(" - ")[0];this.onChoosePromptTitle(o)}};var r6=require("obsidian"),xoe=class extends r6.Modal{constructor(r,n){super(r);this.plugin=n}onOpen(){let{contentEl:r}=this;r.empty(),r.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=r.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;"}}),r.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let i=this.searchInput.value,a=Ry(i,this.app.vault).map(s=>s.path);if(a.length===0){new r6.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let u=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(a),l="CopilotDB-Search-Results.md",c=["## Searched Paths",...a.map(p=>`- [[${p}]]`),"","## Index Data","```json",JSON.stringify(u,null,2),"```"].join(`
`),d=this.app.vault.getAbstractFileByPath(l);d?await this.app.vault.modify(d,c):await this.app.vault.create(l,c);let f=this.app.vault.getAbstractFileByPath(l);f&&await this.app.workspace.getLeaf().openFile(f),this.close()}catch(s){console.error("Error searching DB:",s),new r6.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:r}=this;r.empty()}};var n6=require("obsidian"),Coe=class extends n6.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 n6.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 n6.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 O1t=require("obsidian"),Oin=["Professional","Casual","Straightforward","Confident","Friendly"],Ooe=class extends O1t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTone=n}getItems(){return Oin}getItemText(r){return r}onChooseItem(r,n){this.onChooseTone(r)}};var Eoe=class{get usageData(){return me().promptUsageTimestamps}recordUsage(e){Ft("promptUsageTimestamps",{...this.usageData,[e]:Date.now()})}updateUsage(e,r){let n={...this.usageData};n[r]=n[e],delete n[e],Ft("promptUsageTimestamps",n)}removeUnusedPrompts(e){let r={...this.usageData};for(let n of Object.keys(r))e.includes(n)||delete r[n];Ft("promptUsageTimestamps",r)}compare(e,r){return(this.usageData[e]||0)-(this.usageData[r]||0)}};var oM=require("obsidian"),Yf=class{constructor(e){this.vault=e;this.lastProcessedPrompt=null;this.usageStrategy=new Eoe}get customPromptsFolder(){return me().customPromptsFolder}static getInstance(e){return Yf.instance||(Yf.instance=new Yf(e)),Yf.instance}recordPromptUsage(e){this.usageStrategy.recordUsage(e)}async getAllPrompts(){let e=this.customPromptsFolder,r=this.vault.getFiles().filter(o=>o.path.startsWith(e)&&o.extension==="md"),n=[];for(let o of r){let i=await this.vault.read(o);n.push({title:o.basename,content:i})}return this.usageStrategy.removeUnusedPrompts(n.map(o=>o.title)),n.sort((o,i)=>this.usageStrategy.compare(i.title,o.title)||0)}async getPrompt(e){let r=`${this.customPromptsFolder}/${e}.md`,n=this.vault.getAbstractFileByPath(r);if(n instanceof oM.TFile){let o=await this.vault.read(n);return{title:e,content:o}}return null}async savePrompt(e,r){let n=(0,oM.normalizePath)(this.customPromptsFolder),o=`${n}/${e}.md`;await this.vault.adapter.exists(n)||await this.vault.createFolder(n),await this.vault.create(o,r)}async updatePrompt(e,r,n){let o=`${this.customPromptsFolder}/${e}.md`,i=this.vault.getAbstractFileByPath(o);if(i instanceof oM.TFile){if(e!==r){let a=`${this.customPromptsFolder}/${r}.md`;if(this.vault.getAbstractFileByPath(a))throw new ir("Error saving custom prompt. Please check if the title already exists.");this.usageStrategy.updateUsage(e,r),await this.vault.rename(i,a)}await this.vault.modify(i,n)}}async deletePrompt(e){let r=`${this.customPromptsFolder}/${e}.md`,n=this.vault.getAbstractFileByPath(r);n instanceof oM.TFile&&(this.usageStrategy.removeUnusedPrompts([e]),await this.vault.delete(n))}async extractVariablesFromPrompt(e,r){let n=[],o=/\{([^}]+)\}/g,i;for(;(i=o.exec(e))!==null;){let a=i[1].trim(),s=[];if(a.toLowerCase()==="activenote")if(r){let u=await Jj(r,this.vault);u&&s.push({name:V5(r),content:u})}else new oM.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(c=>c.trim()),l=await pke(this.vault,u);for(let c of l){let d=await Jj(c,this.vault);d&&s.push({name:V5(c),content:d})}}else{let u=gke(a),l=await Ole(this.vault,u);for(let c of l){let d=await Jj(c,this.vault);d&&s.push({name:V5(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(e,r,n){this.lastProcessedPrompt=e;let o=await this.extractVariablesFromPrompt(e,n),i=e,a=[...i.matchAll(/\{([^}]+)\}/g)],s="",u=null;i.includes("{}")&&(i=i.replace(/\{\}/g,"{selectedText}"),r?s+=`selectedText:
${r}`:n?(u=await Jj(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=Ry(i,this.vault);for(let c of l)if(!a.some(d=>d[1].includes(`[[${c.basename}]]`))){let d=await Jj(c,this.vault);d&&(s+=`
Title: [[${c.basename}]]
Path: ${c.path}
${d}`)}return i+`
`+s}async getProcessedVariables(){let e=new Set,r=this.lastProcessedPrompt?.matchAll(/\{([^}]+)\}/g)||[];for(let o of r)e.add(o[1]);let n=Ry(this.lastProcessedPrompt||"",this.vault);for(let o of n)e.add(`[[${o.basename}]]`);return e}};var Nn=require("obsidian");function SD(t){return me().enabledCommands[t]?.enabled!==!1}function pd(t,e,r){SD(e)&&t.addCommand({id:e,name:Dy[e],callback:r})}function hd(t,e,r){SD(e)&&t.addCommand({id:e,name:Dy[e],editorCallback:r})}function E1t(t,e,r){SD(e)&&t.addCommand({id:e,name:Dy[e],checkCallback:r})}async function Xd(t,e,r,n){let o=e.getSelection().trim();if(!o)return;let i=_1t[r],s={message:await i(o,n),sender:Ao,isVisible:!1,timestamp:ys(new Date)};o&&new voe(app,{selectedText:o,commandId:r,promptMessage:s,chainManager:t.chainManager}).open()}function NTe(t){X5.forEach(r=>{t.removeCommand(r)});let e=Yf.getInstance(t.app.vault);hd(t,te.FIX_GRAMMAR,r=>{Xd(t,r,te.FIX_GRAMMAR)}),hd(t,te.SUMMARIZE,r=>{Xd(t,r,te.SUMMARIZE)}),hd(t,te.GENERATE_TOC,r=>{Xd(t,r,te.GENERATE_TOC)}),hd(t,te.GENERATE_GLOSSARY,r=>{Xd(t,r,te.GENERATE_GLOSSARY)}),hd(t,te.SIMPLIFY,r=>{Xd(t,r,te.SIMPLIFY)}),hd(t,te.EMOJIFY,r=>{Xd(t,r,te.EMOJIFY)}),hd(t,te.REMOVE_URLS,r=>{Xd(t,r,te.REMOVE_URLS)}),hd(t,te.REWRITE_TWEET,r=>{Xd(t,r,te.REWRITE_TWEET)}),hd(t,te.REWRITE_TWEET_THREAD,r=>{Xd(t,r,te.REWRITE_TWEET_THREAD)}),hd(t,te.MAKE_SHORTER,r=>{Xd(t,r,te.MAKE_SHORTER)}),hd(t,te.MAKE_LONGER,r=>{Xd(t,r,te.MAKE_LONGER)}),hd(t,te.ELI5,r=>{Xd(t,r,te.ELI5)}),hd(t,te.PRESS_RELEASE,r=>{Xd(t,r,te.PRESS_RELEASE)}),hd(t,te.TRANSLATE,r=>{new Soe(t.app,n=>{if(!n){new Nn.Notice("Please select a language.");return}Xd(t,r,te.TRANSLATE,n)}).open()}),hd(t,te.CHANGE_TONE,r=>{new Ooe(t.app,n=>{if(!n){new Nn.Notice("Please select a tone.");return}Xd(t,r,te.CHANGE_TONE,n)}).open()}),hd(t,te.COUNT_WORD_AND_TOKENS_SELECTION,async r=>{let n=await r.getSelection(),o=n.split(" ").length,i=await t.chainManager.chatModelManager.countTokens(n);new Nn.Notice(`Selected text contains ${o} words and ${i} tokens.`)}),pd(t,te.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let r=await qvt(t.app),n=await t.chainManager.chatModelManager.countTokens(r);new Nn.Notice(`Total tokens in your vault: ${n}`)}catch(r){console.error("Error counting tokens: ",r),new Nn.Notice("An error occurred while counting tokens.")}}),pd(t,te.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),pd(t,te.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),pd(t,te.ADD_CUSTOM_PROMPT,()=>{new t6(t.app,async(r,n)=>{try{await e.savePrompt(r,n),new Nn.Notice("Custom prompt saved successfully.")}catch(o){let i="An error occurred while saving the custom prompt: "+ia(o);throw console.error(i),new Error(i)}}).open()}),pd(t,te.APPLY_CUSTOM_PROMPT,async()=>{let n=(await e.getAllPrompts()).map(o=>o.title);new vO(t.app,n,async o=>{if(!o){new Nn.Notice("Please select a prompt title.");return}try{let i=await e.getPrompt(o);if(!i){new Nn.Notice(`No prompt found with the title "${o}".`);return}t.processCustomPrompt(te.APPLY_CUSTOM_PROMPT,i.content)}catch(i){console.error(i),new Nn.Notice("An error occurred.")}}).open()}),pd(t,te.APPLY_ADHOC_PROMPT,async()=>{new boe(t.app,async n=>{try{t.processCustomPrompt(te.APPLY_ADHOC_PROMPT,n)}catch(o){console.error(o),new Nn.Notice("An error occurred.")}}).open()}),E1t(t,te.DELETE_CUSTOM_PROMPT,r=>(r||e.getAllPrompts().then(n=>{let o=n.map(i=>i.title);new vO(t.app,o,async i=>{if(!i){new Nn.Notice("Please select a prompt title.");return}try{await e.deletePrompt(i),new Nn.Notice(`Prompt "${i}" has been deleted.`)}catch(a){console.error(a),new Nn.Notice("An error occurred while deleting the prompt.")}}).open()}),!0)),E1t(t,te.EDIT_CUSTOM_PROMPT,r=>(r||e.getAllPrompts().then(n=>{let o=n.map(i=>i.title);new vO(t.app,o,async i=>{if(!i){new Nn.Notice("Please select a prompt title.");return}try{let a=await e.getPrompt(i);a?new t6(t.app,async(s,u)=>{try{await e.updatePrompt(i,s,u),new Nn.Notice(`Prompt "${s}" has been updated.`)}catch(l){let c="An error occurred while updating the custom prompt: "+ia(l);throw console.error(c),new Error(c)}},a.title,a.content,!1).open():new Nn.Notice(`No prompt found with the title "${i}".`)}catch(a){console.error(a),new Nn.Notice("An error occurred.")}}).open()}),!0)),pd(t,te.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),pd(t,te.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let r=await t.vectorStoreManager.garbageCollectVectorStore();new Nn.Notice(`${r} documents removed from Copilot index.`)}catch(r){console.error("Error garbage collecting the Copilot index:",r),new Nn.Notice("An error occurred while garbage collecting the Copilot index.")}}),pd(t,te.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let r=await t.vectorStoreManager.indexVaultToVectorStore();new Nn.Notice(`${r} vault files indexed to Copilot index.`)}catch(r){console.error("Error indexing vault to Copilot index:",r),new Nn.Notice("An error occurred while indexing vault to Copilot index.")}}),pd(t,te.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let r=await t.vectorStoreManager.indexVaultToVectorStore(!0);new Nn.Notice(`${r} vault files re-indexed to Copilot index.`)}catch(r){console.error("Error re-indexing vault to Copilot index:",r),new Nn.Notice("An error occurred while re-indexing vault to Copilot index.")}}),pd(t,te.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),pd(t,te.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new xoe(t.app,t).open()}),pd(t,te.SEARCH_ORAMA_DB,()=>{new _oe(t.app,t).open()}),pd(t,te.LIST_INDEXED_FILES,async()=>{try{let r=await t.vectorStoreManager.getIndexedFiles(),n=new Set(r),o=t.app.vault.getMarkdownFiles(),i=new Set,a=new Set,s=new Set,u=await t.vectorStoreManager.getDbOps();for(let h of o){let m=await t.app.vault.cachedRead(h);!m||m.trim().length===0?i.add(h.path):n.has(h.path)?await u.hasEmbeddings(h.path)||s.add(h.path):a.add(h.path)}if(r.length===0&&i.size===0&&a.size===0){new Nn.Notice("No files found to list.");return}let l=["# Copilot Files Status",`- Indexed files: ${r.length}`,` - Files missing embeddings: ${s.size}`,`- Unindexed files: ${a.size}`,`- Empty files: ${i.size}`,"","## Indexed Files",...r.map(h=>{let m=s.has(h);return`- [[${h}]]${m?" *(embedding missing)*":""}`}),"","## Unindexed Files",...a.size>0?Array.from(a).sort().map(h=>`- [[${h}]]`):["No unindexed files found."],"","## Empty Files",...i.size>0?Array.from(i).sort().map(h=>`- [[${h}]]`):["No empty files found."]].join(`
`),d=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,f=t.app.vault.getAbstractFileByPath(d);f instanceof Nn.TFile?await t.app.vault.modify(f,l):await t.app.vault.create(d,l);let p=t.app.vault.getAbstractFileByPath(d);p instanceof Nn.TFile&&(await t.app.workspace.getLeaf().openFile(p),new Nn.Notice(`Listed ${r.length} indexed files`))}catch(r){console.error("Error listing indexed files:",r),new Nn.Notice("Failed to list indexed files.")}}),pd(t,te.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new Coe(t.app,async r=>{let n=await t.vectorStoreManager.getDbOps();try{for(let o of r)await n.removeDocs(o);await n.saveDB(),new Nn.Notice(`Successfully removed ${r.length} files from the index.`)}catch(o){console.error("Error removing files from index:",o),new Nn.Notice("An error occurred while removing files from the index.")}}).open()}),pd(t,te.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),new Nn.Notice("Copilot cache cleared successfully")}catch(r){console.error("Error clearing Copilot cache:",r),new Nn.Notice("Failed to clear Copilot cache")}})}var yr=B(Z());var cl=B(Z(),1);function o6(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Ein=B(Z(),1);function P1t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Poe(...t){return e=>{let r=!1,n=t.map(o=>{let i=P1t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():P1t(t[o],null)}}}}var Cm=B(Z(),1),LTe=B(dt(),1);function T1t(t,e){let r=Cm.createContext(e),n=i=>{let{children:a,...s}=i,u=Cm.useMemo(()=>s,Object.values(s));return(0,LTe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Cm.useContext(r);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,o]}function No(t,e=[]){let r=[];function n(i,a){let s=Cm.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,v=Cm.useMemo(()=>h,Object.values(h));return(0,LTe.jsx)(m.Provider,{value:v,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=Cm.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=>Cm.createContext(a));return function(s){let u=s?.[t]||i;return Cm.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Pin(o,...e)]}function Pin(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return Cm.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var iM=B(Z(),1);var w$=B(Z(),1);function Gt(t){let e=w$.useRef(t);return w$.useEffect(()=>{e.current=t}),w$.useMemo(()=>(...r)=>e.current?.(...r),[])}function ll({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=Tin({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Gt(r),u=iM.useCallback(l=>{if(i){let d=typeof l=="function"?l(t):l;d!==t&&s(d)}else o(l)},[i,t,o,s]);return[a,u]}function Tin({defaultProp:t,onChange:e}){let r=iM.useState(t),[n]=r,o=iM.useRef(n),i=Gt(e);return iM.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var M1t=B(Z(),1),Din=B(_s(),1);var Cc=B(Z(),1);var S$=B(dt(),1),kTe=Cc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Cc.Children.toArray(r),i=o.find(Ain);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,S$.jsx)(FTe,{...n,ref:e,children:Cc.isValidElement(a)?Cc.cloneElement(a,void 0,s):null})}return(0,S$.jsx)(FTe,{...n,ref:e,children:r})});kTe.displayName="Slot";var FTe=Cc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Cc.isValidElement(r)){let o=Iin(r);return Cc.cloneElement(r,{...Rin(n,r.props),ref:e?Poe(e,o):o})}return Cc.Children.count(r)>1?Cc.Children.only(null):null});FTe.displayName="SlotClone";var Min=({children:t})=>(0,S$.jsx)(S$.Fragment,{children:t});function Ain(t){return Cc.isValidElement(t)&&t.type===Min}function Rin(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Iin(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var A1t=B(dt(),1),jin=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],R1t=jin.reduce((t,e)=>{let r=M1t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?kTe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,A1t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var St=B(Z(),1);function pi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var sM=B(Z(),1);var D1t=B(Z(),1);function I1t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function i6(...t){return e=>{let r=!1,n=t.map(o=>{let i=I1t(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():I1t(t[o],null)}}}}function Oc(...t){return D1t.useCallback(i6(...t),t)}var Ec=B(Z(),1);var x$=B(dt(),1),aM=Ec.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ec.Children.toArray(r),i=o.find(Lin);if(i){let a=i.props.children,s=o.map(u=>u===i?Ec.Children.count(a)>1?Ec.Children.only(null):Ec.isValidElement(a)?a.props.children:null:u);return(0,x$.jsx)(BTe,{...n,ref:e,children:Ec.isValidElement(a)?Ec.cloneElement(a,void 0,s):null})}return(0,x$.jsx)(BTe,{...n,ref:e,children:r})});aM.displayName="Slot";var BTe=Ec.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ec.isValidElement(r)){let o=kin(r);return Ec.cloneElement(r,{...Fin(n,r.props),ref:e?i6(e,o):o})}return Ec.Children.count(r)>1?Ec.Children.only(null):null});BTe.displayName="SlotClone";var Nin=({children:t})=>(0,x$.jsx)(x$.Fragment,{children:t});function Lin(t){return Ec.isValidElement(t)&&t.type===Nin}function Fin(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function kin(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Toe=B(dt(),1);function j1t(t){let e=t+"CollectionProvider",[r,n]=No(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,v=sM.default.useRef(null),g=sM.default.useRef(new Map).current;return(0,Toe.jsx)(o,{scope:h,itemMap:g,collectionRef:v,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=sM.default.forwardRef((p,h)=>{let{scope:m,children:v}=p,g=i(s,m),_=Oc(h,g.collectionRef);return(0,Toe.jsx)(aM,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=sM.default.forwardRef((p,h)=>{let{scope:m,children:v,...g}=p,_=sM.default.useRef(null),S=Oc(h,_),x=i(l,m);return sM.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Toe.jsx)(aM,{[c]:"",ref:S,children:v})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return sM.default.useCallback(()=>{let v=h.collectionRef.current;if(!v)return[];let g=Array.from(v.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 Moe=B(Z(),1),Bin=B(dt(),1),$in=Moe.createContext(void 0);function uM(t){let e=Moe.useContext($in);return t||e||"ltr"}var Pa=B(Z(),1);var N1t=B(Z(),1),L1t=B(_s(),1);var F1t=B(dt(),1),qin=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ql=qin.reduce((t,e)=>{let r=N1t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?aM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,F1t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Aoe(t,e){t&&L1t.flushSync(()=>t.dispatchEvent(e))}var k1t=B(Z(),1);function OS(t,e=globalThis?.document){let r=Gt(t);k1t.useEffect(()=>{let n=o=>{o.key==="Escape"&&r(o)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var qTe=B(dt(),1),Uin="DismissableLayer",$Te="dismissableLayer.update",zin="dismissableLayer.pointerDownOutside",Hin="dismissableLayer.focusOutside",B1t,q1t=Pa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),UTe=Pa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Pa.useContext(q1t),[c,d]=Pa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Pa.useState({}),h=Oc(e,E=>d(E)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(v),_=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,O=Jin(E=>{let M=E.target,R=[...l.branches].some(N=>N.contains(M));!x||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Gin(E=>{let M=E.target;[...l.branches].some(N=>N.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return OS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Pa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(B1t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),$1t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=B1t)}},[c,f,r,l]),Pa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),$1t())},[c,l]),Pa.useEffect(()=>{let E=()=>p({});return document.addEventListener($Te,E),()=>document.removeEventListener($Te,E)},[]),(0,qTe.jsx)(ql.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:pi(t.onFocusCapture,T.onFocusCapture),onBlurCapture:pi(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:pi(t.onPointerDownCapture,O.onPointerDownCapture)})});UTe.displayName=Uin;var Vin="DismissableLayerBranch",Win=Pa.forwardRef((t,e)=>{let r=Pa.useContext(q1t),n=Pa.useRef(null),o=Oc(e,n);return Pa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,qTe.jsx)(ql.div,{...t,ref:o})});Win.displayName=Vin;function Jin(t,e=globalThis?.document){let r=Gt(t),n=Pa.useRef(!1),o=Pa.useRef(()=>{});return Pa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){U1t(zin,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Gin(t,e=globalThis?.document){let r=Gt(t),n=Pa.useRef(!1);return Pa.useEffect(()=>{let o=i=>{i.target&&!n.current&&U1t(Hin,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function $1t(){let t=new CustomEvent($Te);document.dispatchEvent(t)}function U1t(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?Aoe(o,i):o.dispatchEvent(i)}var H1t=B(Z(),1),zTe=0;function lM(){H1t.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??z1t()),document.body.insertAdjacentElement("beforeend",t[1]??z1t()),zTe++,()=>{zTe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),zTe--}},[])}function z1t(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Om=B(Z(),1);var K1t=B(dt(),1),HTe="focusScope.autoFocusOnMount",VTe="focusScope.autoFocusOnUnmount",V1t={bubbles:!1,cancelable:!0},Kin="FocusScope",WTe=Om.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Om.useState(null),l=Gt(o),c=Gt(i),d=Om.useRef(null),f=Oc(e,m=>u(m)),p=Om.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Om.useEffect(()=>{if(n){let _=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:cM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||cM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&cM(s)};var m=_,v=S,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Om.useEffect(()=>{if(s){J1t.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(HTe,V1t);s.addEventListener(HTe,l),s.dispatchEvent(g),g.defaultPrevented||(Yin(tan(Y1t(s)),{select:!0}),document.activeElement===m&&cM(s))}return()=>{s.removeEventListener(HTe,l),setTimeout(()=>{let g=new CustomEvent(VTe,V1t);s.addEventListener(VTe,c),s.dispatchEvent(g),g.defaultPrevented||cM(m??document.body,{select:!0}),s.removeEventListener(VTe,c),J1t.remove(p)},0)}}},[s,l,c,p]);let h=Om.useCallback(m=>{if(!r&&!n||p.paused)return;let v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(v&&g){let _=m.currentTarget,[S,x]=Xin(_);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&cM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&cM(x,{select:!0})):g===_&&m.preventDefault()}},[r,n,p.paused]);return(0,K1t.jsx)(ql.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});WTe.displayName=Kin;function Yin(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(cM(n,{select:e}),document.activeElement!==r)return}function Xin(t){let e=Y1t(t),r=W1t(e,t),n=W1t(e.reverse(),t);return[r,n]}function Y1t(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function W1t(t,e){for(let r of t)if(!Zin(r,{upTo:e}))return r}function Zin(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Qin(t){return t instanceof HTMLInputElement&&"select"in t}function cM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Qin(t)&&e&&t.select()}}var J1t=ean();function ean(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=G1t(t,e),t.unshift(e)},remove(e){t=G1t(t,e),t[0]?.resume()}}}function G1t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function tan(t){return t.filter(e=>e.tagName!=="A")}var JTe=B(Z(),1);var X1t=B(Z(),1),qr=Boolean(globalThis?.document)?X1t.useLayoutEffect:()=>{};var ran=JTe["useId".toString()]||(()=>{}),nan=0;function Ga(t){let[e,r]=JTe.useState(ran());return qr(()=>{t||r(n=>n??String(nan++))},[t]),t||(e?`radix-${e}`:"")}var Jp=B(Z(),1);var Z1t=["top","right","bottom","left"];var ES=Math.min,Zd=Math.max,s6=Math.round,u6=Math.floor,ny=t=>({x:t,y:t}),oan={left:"right",right:"left",bottom:"top",top:"bottom"},ian={start:"end",end:"start"};function Ioe(t,e,r){return Zd(t,ES(e,r))}function PS(t,e){return typeof t=="function"?t(e):t}function TS(t){return t.split("-")[0]}function xD(t){return t.split("-")[1]}function Doe(t){return t==="x"?"y":"x"}function joe(t){return t==="y"?"height":"width"}function wO(t){return["top","bottom"].includes(TS(t))?"y":"x"}function Noe(t){return Doe(wO(t))}function Q1t(t,e,r){r===void 0&&(r=!1);let n=xD(t),o=Noe(t),i=joe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=a6(a)),[a,a6(a)]}function eDt(t){let e=a6(t);return[Roe(t),e,Roe(e)]}function Roe(t){return t.replace(/start|end/g,e=>ian[e])}function aan(t,e,r){let n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?o:n:e?n:o;case"left":case"right":return e?i:a;default:return[]}}function tDt(t,e,r,n){let o=xD(t),i=aan(TS(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Roe)))),i}function a6(t){return t.replace(/left|right|bottom|top/g,e=>oan[e])}function san(t){return{top:0,right:0,bottom:0,left:0,...t}}function GTe(t){return typeof t!="number"?san(t):{top:t,right:t,bottom:t,left:t}}function CD(t){let{x:e,y:r,width:n,height:o}=t;return{width:n,height:o,top:r,left:e,right:e+n,bottom:r+o,x:e,y:r}}function rDt(t,e,r){let{reference:n,floating:o}=t,i=wO(e),a=Noe(e),s=joe(a),u=TS(e),l=i==="y",c=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,f=n[s]/2-o[s]/2,p;switch(u){case"top":p={x:c,y:n.y-o.height};break;case"bottom":p={x:c,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-o.width,y:d};break;default:p={x:n.x,y:n.y}}switch(xD(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var iDt=async(t,e,r)=>{let{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(e)),l=await a.getElementRects({reference:t,floating:e,strategy:o}),{x:c,y:d}=rDt(l,n,u),f=n,p={},h=0;for(let m=0;m<s.length;m++){let{name:v,fn:g}=s[m],{x:_,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:t,floating:e}});c=_??c,d=S??d,p={...p,[v]:{...p[v],...x}},O&&h<=50&&(h++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(l=O.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:c,y:d}=rDt(l,f,u)),m=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function C$(t,e){var r;e===void 0&&(e={});let{x:n,y:o,platform:i,rects:a,elements:s,strategy:u}=t,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=PS(e,t),h=GTe(p),v=s[f?d==="floating"?"reference":"floating":d],g=CD(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),_=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,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=CD(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:S,strategy:u}):_);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 aDt=t=>({name:"arrow",options:t,async fn(e){let{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:u}=e,{element:l,padding:c=0}=PS(t,e)||{};if(l==null)return{};let d=GTe(c),f={x:r,y:n},p=Noe(o),h=joe(p),m=await a.getDimensions(l),v=p==="y",g=v?"top":"left",_=v?"bottom":"right",S=v?"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,R=E/2-m[h]/2-1,N=ES(d[g],R),j=ES(d[_],R),k=N,F=E-m[h]-j,L=E/2-m[h]/2+M,q=Ioe(k,L,F),U=!u.arrow&&xD(o)!=null&&L!==q&&i.reference[h]/2-(L<k?N:j)-m[h]/2<0,G=U?L<k?L-k:L-F:0;return{[p]:f[p]+G,data:{[p]:q,centerOffset:L-q-G,...U&&{alignmentOffset:G}},reset:U}}});var sDt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=PS(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=TS(o),_=wO(s),S=TS(s)===s,x=await(u.isRTL==null?void 0:u.isRTL(l.floating)),O=f||(S||!m?[a6(s)]:eDt(s)),T=h!=="none";!f&&T&&O.push(...tDt(s,m,h,x));let E=[s,...O],M=await C$(e,v),R=[],N=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&R.push(M[g]),d){let L=Q1t(o,a,x);R.push(M[L[0]],M[L[1]])}if(N=[...N,{placement:o,overflows:R}],!R.every(L=>L<=0)){var j,k;let L=(((j=i.flip)==null?void 0:j.index)||0)+1,q=E[L];if(q)return{data:{index:L,overflows:N},reset:{placement:q}};let U=(k=N.filter(G=>G.overflows[0]<=0).sort((G,V)=>G.overflows[1]-V.overflows[1])[0])==null?void 0:k.placement;if(!U)switch(p){case"bestFit":{var F;let G=(F=N.filter(V=>{if(T){let I=wO(V.placement);return I===_||I==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(I=>I>0).reduce((I,H)=>I+H,0)]).sort((V,I)=>V[1]-I[1])[0])==null?void 0:F[0];G&&(U=G);break}case"initialPlacement":U=s;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function nDt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function oDt(t){return Z1t.some(e=>t[e]>=0)}var uDt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=PS(t,e);switch(n){case"referenceHidden":{let i=await C$(e,{...o,elementContext:"reference"}),a=nDt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:oDt(a)}}}case"escaped":{let i=await C$(e,{...o,altBoundary:!0}),a=nDt(i,r.floating);return{data:{escapedOffsets:a,escaped:oDt(a)}}}default:return{}}}}};async function uan(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=TS(r),s=xD(r),u=wO(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=PS(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(p=s==="end"?h*-1:h),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var lDt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;let{x:o,y:i,placement:a,middlewareData:s}=e,u=await uan(e,t);return a===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},cDt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:r,y:n,placement:o}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:v=>{let{x:g,y:_}=v;return{x:g,y:_}}},...u}=PS(t,e),l={x:r,y:n},c=await C$(e,u),d=wO(TS(o)),f=Doe(d),p=l[f],h=l[d];if(i){let v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",_=p+c[v],S=p-c[g];p=Ioe(_,p,S)}if(a){let v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",_=h+c[v],S=h-c[g];h=Ioe(_,h,S)}let m=s.fn({...e,[f]:p,[d]:h});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[d]:a}}}}}},dDt=function(t){return t===void 0&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:o,rects:i,middlewareData:a}=e,{offset:s=0,mainAxis:u=!0,crossAxis:l=!0}=PS(t,e),c={x:r,y:n},d=wO(o),f=Doe(d),p=c[f],h=c[d],m=PS(s,e),v=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]+v.mainAxis,O=i.reference[f]+i.reference[S]-v.mainAxis;p<x?p=x:p>O&&(p=O)}if(l){var g,_;let S=f==="y"?"width":"height",x=["top","left"].includes(TS(o)),O=i.reference[d]-i.floating[S]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:v.crossAxis),T=i.reference[d]+i.reference[S]+(x?0:((_=a.offset)==null?void 0:_[d])||0)-(x?v.crossAxis:0);h<O?h=O:h>T&&(h=T)}return{[f]:p,[d]:h}}}},fDt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;let{placement:o,rects:i,platform:a,elements:s}=e,{apply:u=()=>{},...l}=PS(t,e),c=await C$(e,l),d=TS(o),f=xD(o),p=wO(o)==="y",{width:h,height:m}=i.floating,v,g;d==="top"||d==="bottom"?(v=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,v=f==="end"?"top":"bottom");let _=m-c.top-c.bottom,S=h-c.left-c.right,x=ES(m-c[v],_),O=ES(h-c[g],S),T=!e.middlewareData.shift,E=x,M=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(M=S),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=_),T&&!f){let N=Zd(c.left,0),j=Zd(c.right,0),k=Zd(c.top,0),F=Zd(c.bottom,0);p?M=h-2*(N!==0||j!==0?N+j:Zd(c.left,c.right)):E=m-2*(k!==0||F!==0?k+F:Zd(c.top,c.bottom))}await u({...e,availableWidth:M,availableHeight:E});let R=await a.getDimensions(s.floating);return h!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function Loe(){return typeof window<"u"}function ED(t){return hDt(t)?(t.nodeName||"").toLowerCase():"#document"}function Xf(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function oy(t){var e;return(e=(hDt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hDt(t){return Loe()?t instanceof Node||t instanceof Xf(t).Node:!1}function Em(t){return Loe()?t instanceof Element||t instanceof Xf(t).Element:!1}function iy(t){return Loe()?t instanceof HTMLElement||t instanceof Xf(t).HTMLElement:!1}function pDt(t){return!Loe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Xf(t).ShadowRoot}function O$(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=Pm(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function mDt(t){return["table","td","th"].includes(ED(t))}function l6(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Foe(t){let e=koe(),r=Em(t)?Pm(t):t;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function gDt(t){let e=SO(t);for(;iy(e)&&!PD(e);){if(Foe(e))return e;if(l6(e))return null;e=SO(e)}return null}function koe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function PD(t){return["html","body","#document"].includes(ED(t))}function Pm(t){return Xf(t).getComputedStyle(t)}function c6(t){return Em(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function SO(t){if(ED(t)==="html")return t;let e=t.assignedSlot||t.parentNode||pDt(t)&&t.host||oy(t);return pDt(e)?e.host:e}function yDt(t){let e=SO(t);return PD(e)?t.ownerDocument?t.ownerDocument.body:t.body:iy(e)&&O$(e)?e:yDt(e)}function OD(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=yDt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=Xf(o);if(i){let s=Boe(a);return e.concat(a,a.visualViewport||[],O$(o)?o:[],s&&r?OD(s):[])}return e.concat(o,OD(o,[],r))}function Boe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function vDt(t){let e=Pm(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=iy(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=s6(r)!==i||s6(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function YTe(t){return Em(t)?t:t.contextElement}function E$(t){let e=YTe(t);if(!iy(e))return ny(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=vDt(e),a=(i?s6(r.width):r.width)/n,s=(i?s6(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var lan=ny(0);function wDt(t){let e=Xf(t);return!koe()||!e.visualViewport?lan:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function can(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Xf(t)?!1:e}function TD(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=YTe(t),a=ny(1);e&&(n?Em(n)&&(a=E$(n)):a=E$(t));let s=can(i,r,n)?wDt(i):ny(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=Xf(i),p=n&&Em(n)?Xf(n):n,h=f,m=Boe(h);for(;m&&n&&p!==h;){let v=E$(m),g=m.getBoundingClientRect(),_=Pm(m),S=g.left+(m.clientLeft+parseFloat(_.paddingLeft))*v.x,x=g.top+(m.clientTop+parseFloat(_.paddingTop))*v.y;u*=v.x,l*=v.y,c*=v.x,d*=v.y,u+=S,l+=x,h=Xf(m),m=Boe(h)}}return CD({width:c,height:d,x:u,y:l})}function XTe(t,e){let r=c6(t).scrollLeft;return e?e.left+r:TD(oy(t)).left+r}function SDt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:XTe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function dan(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=oy(n),s=e?l6(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=ny(1),c=ny(0),d=iy(n);if((d||!d&&!i)&&((ED(n)!=="body"||O$(a))&&(u=c6(n)),iy(n))){let p=TD(n);l=E$(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?SDt(a,u,!0):ny(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 fan(t){return Array.from(t.getClientRects())}function pan(t){let e=oy(t),r=c6(t),n=t.ownerDocument.body,o=Zd(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Zd(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+XTe(t),s=-r.scrollTop;return Pm(n).direction==="rtl"&&(a+=Zd(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function han(t,e){let r=Xf(t),n=oy(t),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&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function man(t,e){let r=TD(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=iy(t)?E$(t):ny(1),a=t.clientWidth*i.x,s=t.clientHeight*i.y,u=o*i.x,l=n*i.y;return{width:a,height:s,x:u,y:l}}function bDt(t,e,r){let n;if(e==="viewport")n=han(t,r);else if(e==="document")n=pan(oy(t));else if(Em(e))n=man(e,r);else{let o=wDt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return CD(n)}function xDt(t,e){let r=SO(t);return r===e||!Em(r)||PD(r)?!1:Pm(r).position==="fixed"||xDt(r,e)}function gan(t,e){let r=e.get(t);if(r)return r;let n=OD(t,[],!1).filter(s=>Em(s)&&ED(s)!=="body"),o=null,i=Pm(t).position==="fixed",a=i?SO(t):t;for(;Em(a)&&!PD(a);){let s=Pm(a),u=Foe(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||O$(a)&&!u&&xDt(t,a))?n=n.filter(c=>c!==a):o=s,a=SO(a)}return e.set(t,n),n}function yan(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?l6(e)?[]:gan(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=bDt(e,c,o);return l.top=Zd(d.top,l.top),l.right=ES(d.right,l.right),l.bottom=ES(d.bottom,l.bottom),l.left=Zd(d.left,l.left),l},bDt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function ban(t){let{width:e,height:r}=vDt(t);return{width:e,height:r}}function _an(t,e,r){let n=iy(e),o=oy(e),i=r==="fixed",a=TD(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=ny(0);if(n||!n&&!i)if((ED(e)!=="body"||O$(o))&&(s=c6(e)),n){let f=TD(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=XTe(o));let l=o&&!n&&!i?SDt(o,s):ny(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 KTe(t){return Pm(t).position==="static"}function _Dt(t,e){if(!iy(t)||Pm(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return oy(t)===r&&(r=r.ownerDocument.body),r}function CDt(t,e){let r=Xf(t);if(l6(t))return r;if(!iy(t)){let o=SO(t);for(;o&&!PD(o);){if(Em(o)&&!KTe(o))return o;o=SO(o)}return r}let n=_Dt(t,e);for(;n&&mDt(n)&&KTe(n);)n=_Dt(n,e);return n&&PD(n)&&KTe(n)&&!Foe(n)?r:n||gDt(t)||r}var van=async function(t){let e=this.getOffsetParent||CDt,r=this.getDimensions,n=await r(t.floating);return{reference:_an(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function wan(t){return Pm(t).direction==="rtl"}var ODt={convertOffsetParentRelativeRectToViewportRelativeRect:dan,getDocumentElement:oy,getClippingRect:yan,getOffsetParent:CDt,getElementRects:van,getClientRects:fan,getDimensions:ban,getScale:E$,isElement:Em,isRTL:wan};function San(t,e){let r=null,n,o=oy(t);function i(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function a(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),i();let{left:l,top:c,width:d,height:f}=t.getBoundingClientRect();if(s||e(),!d||!f)return;let p=u6(c),h=u6(o.clientWidth-(l+d)),m=u6(o.clientHeight-(c+f)),v=u6(l),_={rootMargin:-p+"px "+-h+"px "+-m+"px "+-v+"px",threshold:Zd(0,ES(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,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,_)}r.observe(t)}return a(!0),i}function xO(t,e,r,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,l=YTe(t),c=o||i?[...l?OD(l):[],...OD(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?San(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[_]=g;_&&_.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let h,m=u?TD(t):null;u&&v();function v(){let g=TD(t);m&&(g.x!==m.x||g.y!==m.y||g.width!==m.width||g.height!==m.height)&&r(),m=g,h=requestAnimationFrame(v)}return r(),()=>{var g;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(h)}}var EDt=lDt;var PDt=cDt,TDt=sDt,MDt=fDt,ADt=uDt,ZTe=aDt;var RDt=dDt,QTe=(t,e,r)=>{let n=new Map,o={platform:ODt,...r},i={...o.platform,_c:n};return iDt(t,e,{...o,platform:i})};var Bu=B(Z(),1),Uoe=B(Z(),1),DDt=B(_s(),1),$oe=typeof document<"u"?Uoe.useLayoutEffect:Uoe.useEffect;function qoe(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!qoe(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),r=o.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=r;n--!==0;){let i=o[n];if(!(i==="_owner"&&t.$$typeof)&&!qoe(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function jDt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function IDt(t,e){let r=jDt(t);return Math.round(e*r)/r}function eMe(t){let e=Bu.useRef(t);return $oe(()=>{e.current=t}),e}function dM(t){t===void 0&&(t={});let{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:u,open:l}=t,[c,d]=Bu.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=Bu.useState(n);qoe(f,n)||p(n);let[h,m]=Bu.useState(null),[v,g]=Bu.useState(null),_=Bu.useCallback(V=>{V!==T.current&&(T.current=V,m(V))},[]),S=Bu.useCallback(V=>{V!==E.current&&(E.current=V,g(V))},[]),x=i||h,O=a||v,T=Bu.useRef(null),E=Bu.useRef(null),M=Bu.useRef(c),R=u!=null,N=eMe(u),j=eMe(o),k=eMe(l),F=Bu.useCallback(()=>{if(!T.current||!E.current)return;let V={placement:e,strategy:r,middleware:f};j.current&&(V.platform=j.current),QTe(T.current,E.current,V).then(I=>{let H={...I,isPositioned:k.current!==!1};L.current&&!qoe(M.current,H)&&(M.current=H,DDt.flushSync(()=>{d(H)}))})},[f,e,r,j,k]);$oe(()=>{l===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(V=>({...V,isPositioned:!1})))},[l]);let L=Bu.useRef(!1);$oe(()=>(L.current=!0,()=>{L.current=!1}),[]),$oe(()=>{if(x&&(T.current=x),O&&(E.current=O),x&&O){if(N.current)return N.current(x,O,F);F()}},[x,O,F,N,R]);let q=Bu.useMemo(()=>({reference:T,floating:E,setReference:_,setFloating:S}),[_,S]),U=Bu.useMemo(()=>({reference:x,floating:O}),[x,O]),G=Bu.useMemo(()=>{let V={position:r,left:0,top:0};if(!U.floating)return V;let I=IDt(U.floating,c.x),H=IDt(U.floating,c.y);return s?{...V,transform:"translate("+I+"px, "+H+"px)",...jDt(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:I,top:H}},[r,s,U.floating,c.x,c.y]);return Bu.useMemo(()=>({...c,update:F,refs:q,elements:U,floatingStyles:G}),[c,F,q,U,G])}var xan=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){let{element:n,padding:o}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?ZTe({element:n.current,padding:o}).fn(r):{}:n?ZTe({element:n,padding:o}).fn(r):{}}}},fM=(t,e)=>({...EDt(t),options:[t,e]}),pM=(t,e)=>({...PDt(t),options:[t,e]}),hM=(t,e)=>({...RDt(t),options:[t,e]}),mM=(t,e)=>({...TDt(t),options:[t,e]}),gM=(t,e)=>({...MDt(t),options:[t,e]});var yM=(t,e)=>({...ADt(t),options:[t,e]});var bM=(t,e)=>({...xan(t),options:[t,e]});var NDt=B(Z(),1);var tMe=B(dt(),1),Can="Arrow",LDt=NDt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,tMe.jsx)(ql.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,tMe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});LDt.displayName=Can;var FDt=LDt;var kDt=B(Z(),1);function Tm(t){let[e,r]=kDt.useState(void 0);return qr(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],a,s;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=t.offsetWidth,s=t.offsetHeight;r({width:a,height:s})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var _M=B(dt(),1);var rMe="Popper",[BDt,nMe]=No(rMe),[Ean,$Dt]=BDt(rMe),qDt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Jp.useState(null);return(0,_M.jsx)(Ean,{scope:e,anchor:n,onAnchorChange:o,children:r})};qDt.displayName=rMe;var UDt="PopperAnchor",zDt=Jp.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=$Dt(UDt,r),a=Jp.useRef(null),s=Oc(e,a);return Jp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,_M.jsx)(ql.div,{...o,ref:s})});zDt.displayName=UDt;var oMe="PopperContent",[Pan,Tan]=BDt(oMe),HDt=Jp.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=t,v=$Dt(oMe,r),[g,_]=Jp.useState(null),S=Oc(e,le=>_(le)),[x,O]=Jp.useState(null),T=Tm(x),E=T?.width??0,M=T?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],k=j.length>0,F={padding:N,boundary:j.filter(Aan),altBoundary:k},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=dM({strategy:"fixed",placement:R,whileElementsMounted:(...le)=>xO(...le,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[fM({mainAxis:o+M,alignmentAxis:a}),u&&pM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hM():void 0,...F}),u&&mM({...F}),gM({...F,apply:({elements:le,rects:Re,availableWidth:gt,availableHeight:Se})=>{let{width:ae,height:ee}=Re.reference,ye=le.floating.style;ye.setProperty("--radix-popper-available-width",`${gt}px`),ye.setProperty("--radix-popper-available-height",`${Se}px`),ye.setProperty("--radix-popper-anchor-width",`${ae}px`),ye.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&bM({element:x,padding:s}),Ran({arrowWidth:E,arrowHeight:M}),f&&yM({strategy:"referenceHidden",...F})]}),[I,H]=JDt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,re=V.arrow?.y,Ae=V.arrow?.centerOffset!==0,[Y,Q]=Jp.useState();return qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,_M.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,["--radix-popper-transform-origin"]:[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,_M.jsx)(Pan,{scope:r,placedSide:I,onArrowChange:O,arrowX:J,arrowY:re,shouldHideArrow:Ae,children:(0,_M.jsx)(ql.div,{"data-side":I,"data-align":H,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});HDt.displayName=oMe;var VDt="PopperArrow",Man={top:"bottom",right:"left",bottom:"top",left:"right"},WDt=Jp.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Tan(VDt,n),a=Man[i.placedSide];return(0,_M.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,_M.jsx)(FDt,{...o,ref:r,style:{...o.style,display:"block"}})})});WDt.displayName=VDt;function Aan(t){return t!==null}var Ran=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=JDt(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 JDt(t){let[e,r="center"]=t.split("-");return[e,r]}var iMe=qDt,GDt=zDt,KDt=HDt,YDt=WDt;var zoe=B(Z(),1),XDt=B(_s(),1);var ZDt=B(dt(),1),Dan="Portal",aMe=zoe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=zoe.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?XDt.default.createPortal((0,ZDt.jsx)(ql.div,{...n,ref:e}),a):null});aMe.displayName=Dan;var Zf=B(Z(),1);var ejt=B(Z(),1);function QDt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function jan(...t){return e=>{let r=!1,n=t.map(o=>{let i=QDt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():QDt(t[o],null)}}}}function tjt(...t){return ejt.useCallback(jan(...t),t)}var rjt=B(Z(),1);function Nan(t,e){return rjt.useReducer((r,n)=>e[r][n]??r,t)}var $u=t=>{let{present:e,children:r}=t,n=Lan(e),o=typeof r=="function"?r({present:n.isPresent}):Zf.Children.only(r),i=tjt(n.ref,Fan(o));return typeof r=="function"||n.isPresent?Zf.cloneElement(o,{ref:i}):null};$u.displayName="Presence";function Lan(t){let[e,r]=Zf.useState(),n=Zf.useRef({}),o=Zf.useRef(t),i=Zf.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Nan(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Zf.useEffect(()=>{let l=Hoe(n.current);i.current=s==="mounted"?l:"none"},[s]),qr(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Hoe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),qr(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=Hoe(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let v=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=p=>{p.target===e&&(i.current=Hoe(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Zf.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Hoe(t){return t?.animationName||"none"}function Fan(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Ul=B(Z(),1);function MD(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var vM=B(Z(),1);var ojt=B(Z(),1);function njt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sMe(...t){return e=>{let r=!1,n=t.map(o=>{let i=njt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():njt(t[o],null)}}}}function d6(...t){return ojt.useCallback(sMe(...t),t)}var Pc=B(Z(),1);var P$=B(dt(),1),T$=Pc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Pc.Children.toArray(r),i=o.find(Ban);if(i){let a=i.props.children,s=o.map(u=>u===i?Pc.Children.count(a)>1?Pc.Children.only(null):Pc.isValidElement(a)?a.props.children:null:u);return(0,P$.jsx)(uMe,{...n,ref:e,children:Pc.isValidElement(a)?Pc.cloneElement(a,void 0,s):null})}return(0,P$.jsx)(uMe,{...n,ref:e,children:r})});T$.displayName="Slot";var uMe=Pc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Pc.isValidElement(r)){let o=qan(r);return Pc.cloneElement(r,{...$an(n,r.props),ref:e?sMe(e,o):o})}return Pc.Children.count(r)>1?Pc.Children.only(null):null});uMe.displayName="SlotClone";var kan=({children:t})=>(0,P$.jsx)(P$.Fragment,{children:t});function Ban(t){return Pc.isValidElement(t)&&t.type===kan}function $an(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function qan(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Voe=B(dt(),1);function ijt(t){let e=t+"CollectionProvider",[r,n]=No(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,v=vM.default.useRef(null),g=vM.default.useRef(new Map).current;return(0,Voe.jsx)(o,{scope:h,itemMap:g,collectionRef:v,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=vM.default.forwardRef((p,h)=>{let{scope:m,children:v}=p,g=i(s,m),_=d6(h,g.collectionRef);return(0,Voe.jsx)(T$,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=vM.default.forwardRef((p,h)=>{let{scope:m,children:v,...g}=p,_=vM.default.useRef(null),S=d6(h,_),x=i(l,m);return vM.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Voe.jsx)(T$,{[c]:"",ref:S,children:v})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return vM.default.useCallback(()=>{let v=h.collectionRef.current;if(!v)return[];let g=Array.from(v.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 ajt=B(Z(),1),Uan=B(_s(),1);var sjt=B(dt(),1),zan=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],lMe=zan.reduce((t,e)=>{let r=ajt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?T$:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,sjt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var wM=B(dt(),1),cMe="rovingFocusGroup.onEntryFocus",Han={bubbles:!1,cancelable:!0},Woe="RovingFocusGroup",[dMe,ujt,Van]=ijt(Woe),[Wan,fMe]=No(Woe,[Van]),[Jan,Gan]=Wan(Woe),ljt=Ul.forwardRef((t,e)=>(0,wM.jsx)(dMe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,wM.jsx)(dMe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,wM.jsx)(Kan,{...t,ref:e})})}));ljt.displayName=Woe;var Kan=Ul.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:c=!1,...d}=t,f=Ul.useRef(null),p=d6(e,f),h=uM(i),[m=null,v]=ll({prop:a,defaultProp:s,onChange:u}),[g,_]=Ul.useState(!1),S=Gt(l),x=ujt(r),O=Ul.useRef(!1),[T,E]=Ul.useState(0);return Ul.useEffect(()=>{let M=f.current;if(M)return M.addEventListener(cMe,S),()=>M.removeEventListener(cMe,S)},[S]),(0,wM.jsx)(Jan,{scope:r,orientation:n,dir:h,loop:o,currentTabStopId:m,onItemFocus:Ul.useCallback(M=>v(M),[v]),onItemShiftTab:Ul.useCallback(()=>_(!0),[]),onFocusableItemAdd:Ul.useCallback(()=>E(M=>M+1),[]),onFocusableItemRemove:Ul.useCallback(()=>E(M=>M-1),[]),children:(0,wM.jsx)(lMe.div,{tabIndex:g||T===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:MD(t.onMouseDown,()=>{O.current=!0}),onFocus:MD(t.onFocus,M=>{let R=!O.current;if(M.target===M.currentTarget&&R&&!g){let N=new CustomEvent(cMe,Han);if(M.currentTarget.dispatchEvent(N),!N.defaultPrevented){let j=x().filter(U=>U.focusable),k=j.find(U=>U.active),F=j.find(U=>U.id===m),q=[k,F,...j].filter(Boolean).map(U=>U.ref.current);fjt(q,c)}}O.current=!1}),onBlur:MD(t.onBlur,()=>_(!1))})})}),cjt="RovingFocusGroupItem",djt=Ul.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=Ga(),u=i||s,l=Gan(cjt,r),c=l.currentTabStopId===u,d=ujt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return Ul.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,wM.jsx)(dMe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,wM.jsx)(lMe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:MD(t.onMouseDown,h=>{n?l.onItemFocus(u):h.preventDefault()}),onFocus:MD(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:MD(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let m=Zan(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(_=>_.focusable).map(_=>_.ref.current);if(m==="last")g.reverse();else if(m==="prev"||m==="next"){m==="prev"&&g.reverse();let _=g.indexOf(h.currentTarget);g=l.loop?Qan(g,_+1):g.slice(_+1)}setTimeout(()=>fjt(g))}})})})});djt.displayName=cjt;var Yan={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xan(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Zan(t,e,r){let n=Xan(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Yan[n]}function fjt(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function Qan(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var pjt=ljt,hjt=djt;var tsn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},M$=new WeakMap,Joe=new WeakMap,Goe={},pMe=0,mjt=function(t){return t&&(t.host||mjt(t.parentNode))},rsn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=mjt(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return Boolean(r)})},nsn=function(t,e,r,n){var o=rsn(e,Array.isArray(t)?t:[t]);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=(M$.get(f)||0)+1,v=(i.get(f)||0)+1;M$.set(f,m),i.set(f,v),a.push(f),m===1&&h&&Joe.set(f,!0),v===1&&f.setAttribute(r,"true"),h||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),pMe++,function(){a.forEach(function(d){var f=M$.get(d)-1,p=i.get(d)-1;M$.set(d,f),i.set(d,p),f||(Joe.has(d)||d.removeAttribute(n),Joe.delete(d)),p||d.removeAttribute(r)}),pMe--,pMe||(M$=new WeakMap,M$=new WeakMap,Joe=new WeakMap,Goe={})}},SM=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||tsn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),nsn(n,o,r,"aria-hidden")):function(){return null}};var Lo=function(){return Lo=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Lo.apply(this,arguments)};function xM(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function A$(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var Qoe=B(Z());var md=B(Z());var ay="right-scroll-bar-position",sy="width-before-scroll-bar",hMe="with-scroll-bars-hidden",mMe="--removed-body-scroll-bar-size";function Koe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var gjt=B(Z());function yjt(t,e){var r=(0,gjt.useState)(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=e,r.facade}var Yoe=B(Z());var osn=typeof window<"u"?Yoe.useLayoutEffect:Yoe.useEffect,bjt=new WeakMap;function AD(t,e){var r=yjt(e||null,function(n){return t.forEach(function(o){return Koe(o,n)})});return osn(function(){var n=bjt.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||Koe(s,null)}),i.forEach(function(s){o.has(s)||Koe(s,a)})}bjt.set(r,t)},[t]),r}function isn(t){return t}function asn(t,e){e===void 0&&(e=isn);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var a=e(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var u=function(){var c=a;a=[],c.forEach(i)},l=function(){return Promise.resolve().then(u)};l(),r={push:function(c){a.push(c),l()},filter:function(c){return a=a.filter(c),r}}}};return o}function RD(t){t===void 0&&(t={});var e=asn(null);return e.options=Lo({async:!0,ssr:!1},t),e}var _jt=B(Z()),vjt=function(t){var e=t.sideCar,r=xM(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return _jt.createElement(n,Lo({},r))};vjt.isSideCarExport=!0;function ID(t,e){return t.useMedium(e),vjt}var Xoe=RD();var gMe=function(){},f6=md.forwardRef(function(t,e){var r=md.useRef(null),n=md.useState({onScrollCapture:gMe,onWheelCapture:gMe,onTouchMoveCapture:gMe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,h=t.inert,m=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,S=xM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=AD([r,e]),T=Lo(Lo({},S),o);return md.createElement(md.Fragment,null,c&&md.createElement(x,{sideCar:Xoe,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?md.cloneElement(md.Children.only(s),Lo(Lo({},T),{ref:O})):md.createElement(g,Lo({},T,{className:u,ref:O}),s))});f6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};f6.classNames={fullWidth:sy,zeroRight:ay};var Di=B(Z());var I$=B(Z());var xjt=B(Z());var wjt;var Sjt=function(){if(wjt)return wjt;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ssn(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Sjt();return e&&t.setAttribute("nonce",e),t}function usn(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function lsn(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var yMe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=ssn())&&(usn(e,r),lsn(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var bMe=function(){var t=yMe();return function(e,r){xjt.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var CO=function(){var t=bMe(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var csn={left:0,top:0,right:0,gap:0},_Me=function(t){return parseInt(t||"",10)||0},dsn=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[_Me(r),_Me(n),_Me(o)]},vMe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return csn;var e=dsn(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}};var fsn=CO(),R$="data-scroll-locked",psn=function(t,e,r,n){var o=t.left,i=t.top,a=t.right,s=t.gap;return r===void 0&&(r="margin"),`
.`.concat(hMe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(R$,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(a,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(s,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(ay,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(sy,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(ay," .").concat(ay,` {
right: 0 `).concat(n,`;
}
.`).concat(sy," .").concat(sy,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(R$,`] {
`).concat(mMe,": ").concat(s,`px;
}
`)},Cjt=function(){var t=parseInt(document.body.getAttribute(R$)||"0",10);return isFinite(t)?t:0},hsn=function(){I$.useEffect(function(){return document.body.setAttribute(R$,(Cjt()+1).toString()),function(){var t=Cjt()-1;t<=0?document.body.removeAttribute(R$):document.body.setAttribute(R$,t.toString())}},[])},DD=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;hsn();var i=I$.useMemo(function(){return vMe(o)},[o]);return I$.createElement(fsn,{styles:psn(i,!e,o,r?"":"!important")})};var wMe=!1;if(typeof window<"u")try{p6=Object.defineProperty({},"passive",{get:function(){return wMe=!0,!0}}),window.addEventListener("test",p6,p6),window.removeEventListener("test",p6,p6)}catch{wMe=!1}var p6,jD=wMe?{passive:!1}:!1;var msn=function(t){return t.tagName==="TEXTAREA"},Ojt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!msn(t)&&r[e]==="visible")},gsn=function(t){return Ojt(t,"overflowY")},ysn=function(t){return Ojt(t,"overflowX")},SMe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Ejt(t,n);if(o){var i=Pjt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bsn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},_sn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Ejt=function(t,e){return t==="v"?gsn(e):ysn(e)},Pjt=function(t,e){return t==="v"?bsn(e):_sn(e)},vsn=function(t,e){return t==="h"&&e==="rtl"?-1:1},Tjt=function(t,e,r,n,o){var i=vsn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=Pjt(t,s),h=p[0],m=p[1],v=p[2],g=m-v-i*h;(h||g)&&Ejt(t,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Zoe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Mjt=function(t){return[t.deltaX,t.deltaY]},Ajt=function(t){return t&&"current"in t?t.current:t},wsn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Ssn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},xsn=0,D$=[];function Rjt(t){var e=Di.useRef([]),r=Di.useRef([0,0]),n=Di.useRef(),o=Di.useState(xsn++)[0],i=Di.useState(CO)[0],a=Di.useRef(t);Di.useEffect(function(){a.current=t},[t]),Di.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=A$([t.lockRef.current],(t.shards||[]).map(Ajt),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Di.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=Zoe(m),_=r.current,S="deltaX"in m?m.deltaX:_[0]-g[0],x="deltaY"in m?m.deltaY:_[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=SMe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=SMe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var R=n.current||O;return Tjt(R,v,m,R==="h"?S:x,!0)},[]),u=Di.useCallback(function(m){var v=m;if(!(!D$.length||D$[D$.length-1]!==i)){var g="deltaY"in v?Mjt(v):Zoe(v),_=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&wsn(O.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var S=(a.current.shards||[]).map(Ajt).filter(Boolean).filter(function(O){return O.contains(v.target)}),x=S.length>0?s(v,S[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=Di.useCallback(function(m,v,g,_){var S={name:m,delta:v,target:g,should:_,shadowParent:Csn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=Di.useCallback(function(m){r.current=Zoe(m),n.current=void 0},[]),d=Di.useCallback(function(m){l(m.type,Mjt(m),m.target,s(m,t.lockRef.current))},[]),f=Di.useCallback(function(m){l(m.type,Zoe(m),m.target,s(m,t.lockRef.current))},[]);Di.useEffect(function(){return D$.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,jD),document.addEventListener("touchmove",u,jD),document.addEventListener("touchstart",c,jD),function(){D$=D$.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,jD),document.removeEventListener("touchmove",u,jD),document.removeEventListener("touchstart",c,jD)}},[]);var p=t.removeScrollBar,h=t.inert;return Di.createElement(Di.Fragment,null,h?Di.createElement(i,{styles:Ssn(o)}):null,p?Di.createElement(DD,{gapMode:t.gapMode}):null)}function Csn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Ijt=ID(Xoe,Rjt);var Djt=Qoe.forwardRef(function(t,e){return Qoe.createElement(f6,Lo({},t,{ref:e,sideCar:Ijt}))});Djt.classNames=f6.classNames;var xMe=Djt;var or=B(dt(),1),CMe=["Enter"," "],Osn=["ArrowDown","PageUp","Home"],Njt=["ArrowUp","PageDown","End"],Esn=[...Osn,...Njt],Psn={ltr:[...CMe,"ArrowRight"],rtl:[...CMe,"ArrowLeft"]},Tsn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},y6="Menu",[m6,Msn,Asn]=j1t(y6),[ND,OMe]=No(y6,[Asn,nMe,fMe]),b6=nMe(),Ljt=fMe(),[Fjt,CM]=ND(y6),[Rsn,_6]=ND(y6),kjt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=b6(e),[u,l]=St.useState(null),c=St.useRef(!1),d=Gt(i),f=uM(o);return St.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,or.jsx)(iMe,{...s,children:(0,or.jsx)(Fjt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,or.jsx)(Rsn,{scope:e,onClose:St.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};kjt.displayName=y6;var Isn="MenuAnchor",EMe=St.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=b6(r);return(0,or.jsx)(GDt,{...o,...n,ref:e})});EMe.displayName=Isn;var PMe="MenuPortal",[Dsn,Bjt]=ND(PMe,{forceMount:void 0}),$jt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=CM(PMe,e);return(0,or.jsx)(Dsn,{scope:e,forceMount:r,children:(0,or.jsx)($u,{present:r||i.open,children:(0,or.jsx)(aMe,{asChild:!0,container:o,children:n})})})};$jt.displayName=PMe;var Mm="MenuContent",[jsn,TMe]=ND(Mm),qjt=St.forwardRef((t,e)=>{let r=Bjt(Mm,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=CM(Mm,t.__scopeMenu),a=_6(Mm,t.__scopeMenu);return(0,or.jsx)(m6.Provider,{scope:t.__scopeMenu,children:(0,or.jsx)($u,{present:n||i.open,children:(0,or.jsx)(m6.Slot,{scope:t.__scopeMenu,children:a.modal?(0,or.jsx)(Nsn,{...o,ref:e}):(0,or.jsx)(Lsn,{...o,ref:e})})})})}),Nsn=St.forwardRef((t,e)=>{let r=CM(Mm,t.__scopeMenu),n=St.useRef(null),o=Oc(e,n);return St.useEffect(()=>{let i=n.current;if(i)return SM(i)},[]),(0,or.jsx)(MMe,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:pi(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Lsn=St.forwardRef((t,e)=>{let r=CM(Mm,t.__scopeMenu);return(0,or.jsx)(MMe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),MMe=St.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:h,...m}=t,v=CM(Mm,r),g=_6(Mm,r),_=b6(r),S=Ljt(r),x=Msn(r),[O,T]=St.useState(null),E=St.useRef(null),M=Oc(e,E,v.onContentChange),R=St.useRef(0),N=St.useRef(""),j=St.useRef(0),k=St.useRef(null),F=St.useRef("right"),L=St.useRef(0),q=h?xMe:St.Fragment,U=h?{as:aM,allowPinchZoom:!0}:void 0,G=I=>{let H=N.current+I,W=x().filter(le=>!le.disabled),J=document.activeElement,re=W.find(le=>le.ref.current===J)?.textValue,Ae=W.map(le=>le.textValue),Y=Ksn(Ae,H,re),Q=W.find(le=>le.textValue===Y)?.ref.current;(function le(Re){N.current=Re,window.clearTimeout(R.current),Re!==""&&(R.current=window.setTimeout(()=>le(""),1e3))})(H),Q&&setTimeout(()=>Q.focus())};St.useEffect(()=>()=>window.clearTimeout(R.current),[]),lM();let V=St.useCallback(I=>F.current===k.current?.side&&Xsn(I,k.current?.area),[]);return(0,or.jsx)(jsn,{scope:r,searchRef:N,onItemEnter:St.useCallback(I=>{V(I)&&I.preventDefault()},[V]),onItemLeave:St.useCallback(I=>{V(I)||(E.current?.focus(),T(null))},[V]),onTriggerLeave:St.useCallback(I=>{V(I)&&I.preventDefault()},[V]),pointerGraceTimerRef:j,onPointerGraceIntentChange:St.useCallback(I=>{k.current=I},[]),children:(0,or.jsx)(q,{...U,children:(0,or.jsx)(WTe,{asChild:!0,trapped:o,onMountAutoFocus:pi(i,I=>{I.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,or.jsx)(UTe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,or.jsx)(pjt,{asChild:!0,...S,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:pi(u,I=>{g.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,or.jsx)(KDt,{role:"menu","aria-orientation":"vertical","data-state":nNt(v.open),"data-radix-menu-content":"",dir:g.dir,..._,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:pi(m.onKeyDown,I=>{let W=I.target.closest("[data-radix-menu-content]")===I.currentTarget,J=I.ctrlKey||I.altKey||I.metaKey,re=I.key.length===1;W&&(I.key==="Tab"&&I.preventDefault(),!J&&re&&G(I.key));let Ae=E.current;if(I.target!==Ae||!Esn.includes(I.key))return;I.preventDefault();let Q=x().filter(le=>!le.disabled).map(le=>le.ref.current);Njt.includes(I.key)&&Q.reverse(),Jsn(Q)}),onBlur:pi(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(R.current),N.current="")}),onPointerMove:pi(t.onPointerMove,g6(I=>{let H=I.target,W=L.current!==I.clientX;if(I.currentTarget.contains(H)&&W){let J=I.clientX>L.current?"right":"left";F.current=J,L.current=I.clientX}}))})})})})})})});qjt.displayName=Mm;var Fsn="MenuGroup",AMe=St.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,or.jsx)(ql.div,{role:"group",...n,ref:e})});AMe.displayName=Fsn;var ksn="MenuLabel",Ujt=St.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,or.jsx)(ql.div,{...n,ref:e})});Ujt.displayName=ksn;var eie="MenuItem",jjt="menu.itemSelect",rie=St.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=St.useRef(null),a=_6(eie,t.__scopeMenu),s=TMe(eie,t.__scopeMenu),u=Oc(e,i),l=St.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(jjt,{bubbles:!0,cancelable:!0});d.addEventListener(jjt,p=>n?.(p),{once:!0}),Aoe(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,or.jsx)(zjt,{...o,ref:u,disabled:r,onClick:pi(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:pi(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:pi(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||CMe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});rie.displayName=eie;var zjt=St.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=TMe(eie,r),s=Ljt(r),u=St.useRef(null),l=Oc(e,u),[c,d]=St.useState(!1),[f,p]=St.useState("");return St.useEffect(()=>{let h=u.current;h&&p((h.textContent??"").trim())},[i.children]),(0,or.jsx)(m6.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,or.jsx)(hjt,{asChild:!0,...s,focusable:!n,children:(0,or.jsx)(ql.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:pi(t.onPointerMove,g6(h=>{n?a.onItemLeave(h):(a.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pi(t.onPointerLeave,g6(h=>a.onItemLeave(h))),onFocus:pi(t.onFocus,()=>d(!0)),onBlur:pi(t.onBlur,()=>d(!1))})})})}),Bsn="MenuCheckboxItem",Hjt=St.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,or.jsx)(Kjt,{scope:t.__scopeMenu,checked:r,children:(0,or.jsx)(rie,{role:"menuitemcheckbox","aria-checked":tie(r)?"mixed":r,...o,ref:e,"data-state":DMe(r),onSelect:pi(o.onSelect,()=>n?.(tie(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Hjt.displayName=Bsn;var Vjt="MenuRadioGroup",[$sn,qsn]=ND(Vjt,{value:void 0,onValueChange:()=>{}}),Wjt=St.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=Gt(n);return(0,or.jsx)($sn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,or.jsx)(AMe,{...o,ref:e})})});Wjt.displayName=Vjt;var Jjt="MenuRadioItem",Gjt=St.forwardRef((t,e)=>{let{value:r,...n}=t,o=qsn(Jjt,t.__scopeMenu),i=r===o.value;return(0,or.jsx)(Kjt,{scope:t.__scopeMenu,checked:i,children:(0,or.jsx)(rie,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":DMe(i),onSelect:pi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});Gjt.displayName=Jjt;var RMe="MenuItemIndicator",[Kjt,Usn]=ND(RMe,{checked:!1}),Yjt=St.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Usn(RMe,r);return(0,or.jsx)($u,{present:n||tie(i.checked)||i.checked===!0,children:(0,or.jsx)(ql.span,{...o,ref:e,"data-state":DMe(i.checked)})})});Yjt.displayName=RMe;var zsn="MenuSeparator",Xjt=St.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,or.jsx)(ql.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});Xjt.displayName=zsn;var Hsn="MenuArrow",Zjt=St.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=b6(r);return(0,or.jsx)(YDt,{...o,...n,ref:e})});Zjt.displayName=Hsn;var IMe="MenuSub",[Vsn,Qjt]=ND(IMe),Wsn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=CM(IMe,e),a=b6(e),[s,u]=St.useState(null),[l,c]=St.useState(null),d=Gt(o);return St.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,or.jsx)(iMe,{...a,children:(0,or.jsx)(Fjt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,or.jsx)(Vsn,{scope:e,contentId:Ga(),triggerId:Ga(),trigger:s,onTriggerChange:u,children:r})})})};Wsn.displayName=IMe;var h6="MenuSubTrigger",eNt=St.forwardRef((t,e)=>{let r=CM(h6,t.__scopeMenu),n=_6(h6,t.__scopeMenu),o=Qjt(h6,t.__scopeMenu),i=TMe(h6,t.__scopeMenu),a=St.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=St.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return St.useEffect(()=>c,[c]),St.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,or.jsx)(EMe,{asChild:!0,...l,children:(0,or.jsx)(zjt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":nNt(r.open),...t,ref:i6(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:pi(t.onPointerMove,g6(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100))})),onPointerLeave:pi(t.onPointerLeave,g6(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,h=p==="right",m=h?-5:5,v=f[h?"left":"right"],g=f[h?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:v,y:f.bottom}],side:p}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:pi(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Psn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});eNt.displayName=h6;var tNt="MenuSubContent",rNt=St.forwardRef((t,e)=>{let r=Bjt(Mm,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=CM(Mm,t.__scopeMenu),a=_6(Mm,t.__scopeMenu),s=Qjt(tNt,t.__scopeMenu),u=St.useRef(null),l=Oc(e,u);return(0,or.jsx)(m6.Provider,{scope:t.__scopeMenu,children:(0,or.jsx)($u,{present:n||i.open,children:(0,or.jsx)(m6.Slot,{scope:t.__scopeMenu,children:(0,or.jsx)(MMe,{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(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:pi(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:pi(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Tsn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});rNt.displayName=tNt;function nNt(t){return t?"open":"closed"}function tie(t){return t==="indeterminate"}function DMe(t){return tie(t)?"indeterminate":t?"checked":"unchecked"}function Jsn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Gsn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function Ksn(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=Gsn(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function Ysn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i].x,u=e[i].y,l=e[a].x,c=e[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Xsn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return Ysn(r,e)}function g6(t){return e=>e.pointerType==="mouse"?t(e):void 0}var oNt=kjt,iNt=EMe,aNt=$jt,sNt=qjt,uNt=AMe,lNt=Ujt,cNt=rie,dNt=Hjt,fNt=Wjt,pNt=Gjt,hNt=Yjt,mNt=Xjt,gNt=Zjt;var yNt=eNt,bNt=rNt;var zl=B(dt(),1),jMe="DropdownMenu",[Qsn,Zzo]=No(jMe,[OMe]),Qd=OMe(),[eun,_Nt]=Qsn(jMe),v6=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=Qd(e),l=cl.useRef(null),[c=!1,d]=ll({prop:o,defaultProp:i,onChange:a});return(0,zl.jsx)(eun,{scope:e,triggerId:Ga(),triggerRef:l,contentId:Ga(),open:c,onOpenChange:d,onOpenToggle:cl.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,zl.jsx)(oNt,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};v6.displayName=jMe;var vNt="DropdownMenuTrigger",w6=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=_Nt(vNt,r),a=Qd(r);return(0,zl.jsx)(iNt,{asChild:!0,...a,children:(0,zl.jsx)(R1t.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:Poe(e,i.triggerRef),onPointerDown:o6(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:o6(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});w6.displayName=vNt;var tun="DropdownMenuPortal",wNt=t=>{let{__scopeDropdownMenu:e,...r}=t,n=Qd(e);return(0,zl.jsx)(aNt,{...n,...r})};wNt.displayName=tun;var SNt="DropdownMenuContent",xNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=_Nt(SNt,r),i=Qd(r),a=cl.useRef(!1);return(0,zl.jsx)(sNt,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:o6(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:o6(t.onInteractOutside,s=>{let u=s.detail.originalEvent,l=u.button===0&&u.ctrlKey===!0,c=u.button===2||l;(!o.modal||c)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xNt.displayName=SNt;var run="DropdownMenuGroup",nun=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(uNt,{...o,...n,ref:e})});nun.displayName=run;var oun="DropdownMenuLabel",CNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(lNt,{...o,...n,ref:e})});CNt.displayName=oun;var iun="DropdownMenuItem",ONt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(cNt,{...o,...n,ref:e})});ONt.displayName=iun;var aun="DropdownMenuCheckboxItem",ENt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(dNt,{...o,...n,ref:e})});ENt.displayName=aun;var sun="DropdownMenuRadioGroup",uun=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(fNt,{...o,...n,ref:e})});uun.displayName=sun;var lun="DropdownMenuRadioItem",PNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(pNt,{...o,...n,ref:e})});PNt.displayName=lun;var cun="DropdownMenuItemIndicator",TNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(hNt,{...o,...n,ref:e})});TNt.displayName=cun;var dun="DropdownMenuSeparator",MNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(mNt,{...o,...n,ref:e})});MNt.displayName=dun;var fun="DropdownMenuArrow",pun=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(gNt,{...o,...n,ref:e})});pun.displayName=fun;var hun="DropdownMenuSubTrigger",ANt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(yNt,{...o,...n,ref:e})});ANt.displayName=hun;var mun="DropdownMenuSubContent",RNt=cl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Qd(r);return(0,zl.jsx)(bNt,{...o,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});RNt.displayName=mun;var INt=v6,DNt=w6,jNt=wNt,NMe=xNt;var LMe=CNt,FMe=ONt,kMe=ENt;var BMe=PNt,$Me=TNt,qMe=MNt;var UMe=ANt,zMe=RNt;var oi=B(Z());var nie=INt,oie=DNt;var yun=oi.forwardRef(({className:t,inset:e,children:r,...n},o)=>oi.createElement(UMe,{ref:o,className:Te("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-dropdown-hover data-[state=open]:bg-dropdown-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...n},r,oi.createElement(ZA,{className:"ml-auto"})));yun.displayName=UMe.displayName;var bun=oi.forwardRef(({className:t,...e},r)=>oi.createElement(zMe,{ref:r,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-primary p-1 text-normal shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));bun.displayName=zMe.displayName;var OM=oi.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>oi.createElement(jNt,{container:r??activeDocument.body},oi.createElement(NMe,{ref:o,sideOffset:e,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border border-solid bg-primary p-1 text-normal shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})));OM.displayName=NMe.displayName;var Tc=oi.forwardRef(({className:t,inset:e,...r},n)=>oi.createElement(FMe,{ref:n,className:Te("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...r}));Tc.displayName=FMe.displayName;var _un=oi.forwardRef(({className:t,children:e,checked:r,...n},o)=>oi.createElement(kMe,{ref:o,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n},oi.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},oi.createElement($Me,null,oi.createElement(cg,{className:"h-4 w-4"}))),e));_un.displayName=kMe.displayName;var vun=oi.forwardRef(({className:t,children:e,...r},n)=>oi.createElement(BMe,{ref:n,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r},oi.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},oi.createElement($Me,null,oi.createElement(cz,{className:"h-2 w-2 fill-current"}))),e));vun.displayName=BMe.displayName;var wun=oi.forwardRef(({className:t,inset:e,...r},n)=>oi.createElement(LMe,{ref:n,className:Te("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));wun.displayName=LMe.displayName;var Sun=oi.forwardRef(({className:t,...e},r)=>oi.createElement(qMe,{ref:r,className:Te("-mx-1 my-1 h-px bg-muted",t),...e}));Sun.displayName=qMe.displayName;var xun=({className:t,...e})=>oi.createElement("span",{className:Te("ml-auto text-xs tracking-widest opacity-60",t),...e});xun.displayName="DropdownMenuShortcut";var S6=B(Z());var MS=S6.forwardRef(({checked:t=!1,onCheckedChange:e,disabled:r=!1,className:n,...o},i)=>{let a=()=>{r||e?.(!t)},s=u=>{r||(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e?.(!t))};return S6.createElement("div",{role:"switch","aria-checked":t,"aria-disabled":r,"data-state":t?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:Te("relative inline-flex h-5.5 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t?"bg-interactive-accent":"bg-[--background-modifier-border-hover]",r&&"cursor-not-allowed opacity-50",n),onClick:a,onKeyDown:s,...o},S6.createElement("div",{className:Te("pointer-events-none block h-4 w-4 rounded-full bg-toggle-thumb shadow-lg ring-0 transition-transform",t?"translate-x-5.5":"translate-x-0.5")}))});MS.displayName="SettingSwitch";var C6=B(Z());var Or=B(Z(),1);function uy(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var LNt=B(Z(),1);function NNt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function HMe(...t){return e=>{let r=!1,n=t.map(o=>{let i=NNt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():NNt(t[o],null)}}}}function OO(...t){return LNt.useCallback(HMe(...t),t)}var Ta=B(Z(),1);var FNt=B(Z(),1),kNt=B(_s(),1);var Mc=B(Z(),1);var j$=B(dt(),1),WMe=Mc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Mc.Children.toArray(r),i=o.find(Cun);if(i){let a=i.props.children,s=o.map(u=>u===i?Mc.Children.count(a)>1?Mc.Children.only(null):Mc.isValidElement(a)?a.props.children:null:u);return(0,j$.jsx)(VMe,{...n,ref:e,children:Mc.isValidElement(a)?Mc.cloneElement(a,void 0,s):null})}return(0,j$.jsx)(VMe,{...n,ref:e,children:r})});WMe.displayName="Slot";var VMe=Mc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Mc.isValidElement(r)){let o=Eun(r);return Mc.cloneElement(r,{...Oun(n,r.props),ref:e?HMe(e,o):o})}return Mc.Children.count(r)>1?Mc.Children.only(null):null});VMe.displayName="SlotClone";var JMe=({children:t})=>(0,j$.jsx)(j$.Fragment,{children:t});function Cun(t){return Mc.isValidElement(t)&&t.type===JMe}function Oun(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Eun(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var BNt=B(dt(),1),Pun=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Am=Pun.reduce((t,e)=>{let r=FNt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?WMe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,BNt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function $Nt(t,e){t&&kNt.flushSync(()=>t.dispatchEvent(e))}var KMe=B(dt(),1),Tun="DismissableLayer",GMe="dismissableLayer.update",Mun="dismissableLayer.pointerDownOutside",Aun="dismissableLayer.focusOutside",qNt,zNt=Ta.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),YMe=Ta.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ta.useContext(zNt),[c,d]=Ta.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ta.useState({}),h=OO(e,E=>d(E)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(v),_=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,O=Dun(E=>{let M=E.target,R=[...l.branches].some(N=>N.contains(M));!x||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=jun(E=>{let M=E.target;[...l.branches].some(N=>N.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return OS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ta.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(qNt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),UNt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=qNt)}},[c,f,r,l]),Ta.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),UNt())},[c,l]),Ta.useEffect(()=>{let E=()=>p({});return document.addEventListener(GMe,E),()=>document.removeEventListener(GMe,E)},[]),(0,KMe.jsx)(Am.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:uy(t.onFocusCapture,T.onFocusCapture),onBlurCapture:uy(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:uy(t.onPointerDownCapture,O.onPointerDownCapture)})});YMe.displayName=Tun;var Run="DismissableLayerBranch",Iun=Ta.forwardRef((t,e)=>{let r=Ta.useContext(zNt),n=Ta.useRef(null),o=OO(e,n);return Ta.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,KMe.jsx)(Am.div,{...t,ref:o})});Iun.displayName=Run;function Dun(t,e=globalThis?.document){let r=Gt(t),n=Ta.useRef(!1),o=Ta.useRef(()=>{});return Ta.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){HNt(Mun,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function jun(t,e=globalThis?.document){let r=Gt(t),n=Ta.useRef(!1);return Ta.useEffect(()=>{let o=i=>{i.target&&!n.current&&HNt(Aun,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function UNt(){let t=new CustomEvent(GMe);document.dispatchEvent(t)}function HNt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?$Nt(o,i):o.dispatchEvent(i)}var Gp=B(Z(),1);var VNt=B(Z(),1);var XMe=B(dt(),1),Nun="Arrow",WNt=VNt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,XMe.jsx)(Am.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,XMe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});WNt.displayName=Nun;var JNt=WNt;var EM=B(dt(),1);var ZMe="Popper",[GNt,QMe]=No(ZMe),[Fun,KNt]=GNt(ZMe),YNt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Gp.useState(null);return(0,EM.jsx)(Fun,{scope:e,anchor:n,onAnchorChange:o,children:r})};YNt.displayName=ZMe;var XNt="PopperAnchor",ZNt=Gp.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=KNt(XNt,r),a=Gp.useRef(null),s=OO(e,a);return Gp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,EM.jsx)(Am.div,{...o,ref:s})});ZNt.displayName=XNt;var eAe="PopperContent",[kun,$un]=GNt(eAe),QNt=Gp.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=t,v=KNt(eAe,r),[g,_]=Gp.useState(null),S=OO(e,le=>_(le)),[x,O]=Gp.useState(null),T=Tm(x),E=T?.width??0,M=T?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],k=j.length>0,F={padding:N,boundary:j.filter(Uun),altBoundary:k},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=dM({strategy:"fixed",placement:R,whileElementsMounted:(...le)=>xO(...le,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[fM({mainAxis:o+M,alignmentAxis:a}),u&&pM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hM():void 0,...F}),u&&mM({...F}),gM({...F,apply:({elements:le,rects:Re,availableWidth:gt,availableHeight:Se})=>{let{width:ae,height:ee}=Re.reference,ye=le.floating.style;ye.setProperty("--radix-popper-available-width",`${gt}px`),ye.setProperty("--radix-popper-available-height",`${Se}px`),ye.setProperty("--radix-popper-anchor-width",`${ae}px`),ye.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&bM({element:x,padding:s}),zun({arrowWidth:E,arrowHeight:M}),f&&yM({strategy:"referenceHidden",...F})]}),[I,H]=rLt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,re=V.arrow?.y,Ae=V.arrow?.centerOffset!==0,[Y,Q]=Gp.useState();return qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,EM.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,["--radix-popper-transform-origin"]:[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,EM.jsx)(kun,{scope:r,placedSide:I,onArrowChange:O,arrowX:J,arrowY:re,shouldHideArrow:Ae,children:(0,EM.jsx)(Am.div,{"data-side":I,"data-align":H,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});QNt.displayName=eAe;var eLt="PopperArrow",qun={top:"bottom",right:"left",bottom:"top",left:"right"},tLt=Gp.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=$un(eLt,n),a=qun[i.placedSide];return(0,EM.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,EM.jsx)(JNt,{...o,ref:r,style:{...o.style,display:"block"}})})});tLt.displayName=eLt;function Uun(t){return t!==null}var zun=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=rLt(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 rLt(t){let[e,r="center"]=t.split("-");return[e,r]}var nLt=YNt,oLt=ZNt,iLt=QNt,aLt=tLt;var iie=B(Z(),1),sLt=B(_s(),1);var uLt=B(dt(),1),Vun="Portal",tAe=iie.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=iie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?sLt.default.createPortal((0,uLt.jsx)(Am.div,{...n,ref:e}),a):null});tAe.displayName=Vun;var hLt=B(Z(),1);var dLt=B(Z(),1),Xun=B(_s(),1);var Ac=B(Z(),1);var Wun=B(Z(),1);function lLt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cLt(...t){return e=>{let r=!1,n=t.map(o=>{let i=lLt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():lLt(t[o],null)}}}}var N$=B(dt(),1),nAe=Ac.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ac.Children.toArray(r),i=o.find(Gun);if(i){let a=i.props.children,s=o.map(u=>u===i?Ac.Children.count(a)>1?Ac.Children.only(null):Ac.isValidElement(a)?a.props.children:null:u);return(0,N$.jsx)(rAe,{...n,ref:e,children:Ac.isValidElement(a)?Ac.cloneElement(a,void 0,s):null})}return(0,N$.jsx)(rAe,{...n,ref:e,children:r})});nAe.displayName="Slot";var rAe=Ac.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ac.isValidElement(r)){let o=Yun(r);return Ac.cloneElement(r,{...Kun(n,r.props),ref:e?cLt(e,o):o})}return Ac.Children.count(r)>1?Ac.Children.only(null):null});rAe.displayName="SlotClone";var Jun=({children:t})=>(0,N$.jsx)(N$.Fragment,{children:t});function Gun(t){return Ac.isValidElement(t)&&t.type===Jun}function Kun(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Yun(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var fLt=B(dt(),1),Zun=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],pLt=Zun.reduce((t,e)=>{let r=dLt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?nAe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,fLt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var mLt=B(dt(),1),Qun="VisuallyHidden",gLt=hLt.forwardRef((t,e)=>(0,mLt.jsx)(pLt.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));gLt.displayName=Qun;var yLt=gLt;var qu=B(dt(),1),[aie,J2o]=No("Tooltip",[QMe]),sie=QMe(),bLt="TooltipProvider",tln=700,oAe="tooltip.open",[rln,aAe]=aie(bLt),_Lt=t=>{let{__scopeTooltip:e,delayDuration:r=tln,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,[a,s]=Or.useState(!0),u=Or.useRef(!1),l=Or.useRef(0);return Or.useEffect(()=>{let c=l.current;return()=>window.clearTimeout(c)},[]),(0,qu.jsx)(rln,{scope:e,isOpenDelayed:a,delayDuration:r,onOpen:Or.useCallback(()=>{window.clearTimeout(l.current),s(!1)},[]),onClose:Or.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:Or.useCallback(c=>{u.current=c},[]),disableHoverableContent:o,children:i})};_Lt.displayName=bLt;var uie="Tooltip",[nln,x6]=aie(uie),vLt=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=aAe(uie,t.__scopeTooltip),l=sie(e),[c,d]=Or.useState(null),f=Ga(),p=Or.useRef(0),h=a??u.disableHoverableContent,m=s??u.delayDuration,v=Or.useRef(!1),[g=!1,_]=ll({prop:n,defaultProp:o,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(oAe))):u.onClose(),i?.(E)}}),S=Or.useMemo(()=>g?v.current?"delayed-open":"instant-open":"closed",[g]),x=Or.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,_(!0)},[_]),O=Or.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),T=Or.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,_(!0),p.current=0},m)},[m,_]);return Or.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,qu.jsx)(nLt,{...l,children:(0,qu.jsx)(nln,{scope:e,contentId:f,open:g,stateAttribute:S,trigger:c,onTriggerChange:d,onTriggerEnter:Or.useCallback(()=>{u.isOpenDelayed?T():x()},[u.isOpenDelayed,T,x]),onTriggerLeave:Or.useCallback(()=>{h?O():(window.clearTimeout(p.current),p.current=0)},[O,h]),onOpen:x,onClose:O,disableHoverableContent:h,children:r})})};vLt.displayName=uie;var iAe="TooltipTrigger",wLt=Or.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=x6(iAe,r),i=aAe(iAe,r),a=sie(r),s=Or.useRef(null),u=OO(e,s,o.onTriggerChange),l=Or.useRef(!1),c=Or.useRef(!1),d=Or.useCallback(()=>l.current=!1,[]);return Or.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,qu.jsx)(oLt,{asChild:!0,...a,children:(0,qu.jsx)(Am.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:uy(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:uy(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:uy(t.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:uy(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:uy(t.onBlur,o.onClose),onClick:uy(t.onClick,o.onClose)})})});wLt.displayName=iAe;var sAe="TooltipPortal",[oln,iln]=aie(sAe,{forceMount:void 0}),SLt=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=x6(sAe,e);return(0,qu.jsx)(oln,{scope:e,forceMount:r,children:(0,qu.jsx)($u,{present:r||i.open,children:(0,qu.jsx)(tAe,{asChild:!0,container:o,children:n})})})};SLt.displayName=sAe;var L$="TooltipContent",xLt=Or.forwardRef((t,e)=>{let r=iln(L$,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=x6(L$,t.__scopeTooltip);return(0,qu.jsx)($u,{present:n||a.open,children:a.disableHoverableContent?(0,qu.jsx)(CLt,{side:o,...i,ref:e}):(0,qu.jsx)(aln,{side:o,...i,ref:e})})}),aln=Or.forwardRef((t,e)=>{let r=x6(L$,t.__scopeTooltip),n=aAe(L$,t.__scopeTooltip),o=Or.useRef(null),i=OO(e,o),[a,s]=Or.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Or.useCallback(()=>{s(null),d(!1)},[d]),p=Or.useCallback((h,m)=>{let v=h.currentTarget,g={x:h.clientX,y:h.clientY},_=cln(g,v.getBoundingClientRect()),S=dln(g,_),x=fln(m.getBoundingClientRect()),O=hln([...S,...x]);s(O),d(!0)},[d]);return Or.useEffect(()=>()=>f(),[f]),Or.useEffect(()=>{if(u&&c){let h=v=>p(v,c),m=v=>p(v,u);return u.addEventListener("pointerleave",h),c.addEventListener("pointerleave",m),()=>{u.removeEventListener("pointerleave",h),c.removeEventListener("pointerleave",m)}}},[u,c,p,f]),Or.useEffect(()=>{if(a){let h=m=>{let v=m.target,g={x:m.clientX,y:m.clientY},_=u?.contains(v)||c?.contains(v),S=!pln(g,a);_?f():S&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[u,c,a,l,f]),(0,qu.jsx)(CLt,{...t,ref:i})}),[sln,uln]=aie(uie,{isInside:!1}),CLt=Or.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=x6(L$,r),l=sie(r),{onClose:c}=u;return Or.useEffect(()=>(document.addEventListener(oAe,c),()=>document.removeEventListener(oAe,c)),[c]),Or.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,qu.jsx)(YMe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,qu.jsxs)(iLt,{"data-state":u.stateAttribute,...l,...s,ref:e,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,qu.jsx)(JMe,{children:n}),(0,qu.jsx)(sln,{scope:r,isInside:!0,children:(0,qu.jsx)(yLt,{id:u.contentId,role:"tooltip",children:o||n})})]})})});xLt.displayName=L$;var OLt="TooltipArrow",lln=Or.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=sie(r);return uln(OLt,r).isInside?null:(0,qu.jsx)(aLt,{...o,...n,ref:e})});lln.displayName=OLt;function cln(t,e){let r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,o,i)){case i:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function dln(t,e,r=5){let n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function fln(t){let{top:e,right:r,bottom:n,left:o}=t;return[{x:o,y:e},{x:r,y:e},{x:r,y:n},{x:o,y:n}]}function pln(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i].x,u=e[i].y,l=e[a].x,c=e[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function hln(t){let e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),mln(e)}function mln(t){if(t.length<=1)return t.slice();let e=[];for(let n=0;n<t.length;n++){let o=t[n];for(;e.length>=2;){let i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))e.pop();else break}e.push(o)}e.pop();let r=[];for(let n=t.length-1;n>=0;n--){let o=t[n];for(;r.length>=2;){let i=r[r.length-1],a=r[r.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))r.pop();else break}r.push(o)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var lie=_Lt,ELt=vLt,PLt=wLt,TLt=SLt,uAe=xLt;var gd=lie,Jr=ELt,Gr=PLt,Hr=C6.forwardRef(({className:t,sideOffset:e=4,...r},n)=>C6.createElement(TLt,{container:activeDocument.body},C6.createElement(uAe,{ref:n,sideOffset:e,className:Te("z-50 overflow-hidden rounded-md bg-secondary border-border border border-solid px-3 py-1.5 text-xs text-normal animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})));Hr.displayName=uAe.displayName;var lAe=require("obsidian");async function gln(){try{await Ki.getInstance().indexVaultToVectorStore(),new lAe.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new lAe.Notice("Failed to refresh vault index. Check console for details.")}}function ALt({onNewChat:t,onSaveAsNote:e}){let r=Fa(),[n,o]=jy(),i=tee();return yr.default.createElement("div",{className:"w-full py-1 flex justify-between items-center px-1"},yr.default.createElement("div",{className:"flex-1"},yr.default.createElement(v6,null,yr.default.createElement(w6,{asChild:!0},yr.default.createElement(Ge,{variant:"ghost2",size:"fit",className:"ml-1"},n==="llm_chain"&&"chat",n==="vault_qa"&&"vault QA",n==="copilot_plus"&&yr.default.createElement("div",{className:"flex items-center gap-1"},yr.default.createElement(Uy,{className:"size-4"}),"copilot plus (beta)"),yr.default.createElement(Sl,{className:"size-5 mt-0.5"}))),yr.default.createElement(OM,{align:"start"},yr.default.createElement(Tc,{onSelect:()=>o("llm_chain")},"chat"),yr.default.createElement(Tc,{onSelect:()=>o("vault_qa")},"vault QA"),i?yr.default.createElement(Tc,{onSelect:()=>o("copilot_plus")},yr.default.createElement("div",{className:"flex items-center gap-1"},yr.default.createElement(Uy,{className:"size-4"}),"copilot plus (beta)")):yr.default.createElement(Tc,{onSelect:()=>{DN(hE.CHAT_MODE_SELECT)}},"copilot plus (beta)",yr.default.createElement(UE,{className:"size-3"}))))),yr.default.createElement("div",null,yr.default.createElement(Jr,null,yr.default.createElement(Gr,{asChild:!0},yr.default.createElement(Ge,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},yr.default.createElement(xz,{className:"size-4"}))),yr.default.createElement(Hr,null,"New Chat")),yr.default.createElement(Jr,null,yr.default.createElement(Gr,{asChild:!0},yr.default.createElement(Ge,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},yr.default.createElement(mz,{className:"size-4"}))),yr.default.createElement(Hr,null,"Save Chat as Note")),yr.default.createElement(v6,null,yr.default.createElement(w6,{asChild:!0},yr.default.createElement(Ge,{variant:"ghost2",size:"icon",title:"Advanced Settings"},yr.default.createElement($E,{className:"size-4"}))),yr.default.createElement(OM,{align:"end",className:"w-64"},yr.default.createElement(Tc,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),Ft("showSuggestedPrompts",!r.showSuggestedPrompts)}},yr.default.createElement("div",{className:"flex items-center gap-2"},yr.default.createElement(Uy,{className:"size-4"}),"Suggested Prompt"),yr.default.createElement(MS,{checked:r.showSuggestedPrompts})),yr.default.createElement(Tc,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),Ft("showRelevantNotes",!r.showRelevantNotes)}},yr.default.createElement("div",{className:"flex items-center gap-2"},yr.default.createElement(nR,{className:"size-4"}),"Relevant Note"),yr.default.createElement(MS,{checked:r.showRelevantNotes})),yr.default.createElement(Tc,{className:"flex items-center gap-2",onSelect:()=>gln()},yr.default.createElement(Oz,{className:"size-4"}),"Refresh Vault Index")))))}var RLt=require("obsidian");var die=require("obsidian"),cie=class extends die.FuzzySuggestModal{constructor(r){super(r);this.activeNote=r.workspace.getActiveFile()}getOrderedNotes(r=[]){let n=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof die.TFile&&(a.extension==="md"||a.extension==="pdf")&&!r.includes(a.path)&&a.path!==this.activeNote?.path),i=this.app.vault.getFiles().filter(a=>a.extension==="md"||a.extension==="pdf").filter(a=>!n.some(s=>s.path===a.path)&&!r.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...n,...i]}formatNoteTitle(r,n,o){let i=r;return n&&(i+=" (current)"),o==="pdf"&&(i+=" (PDF)"),i}};var PM=class extends cie{constructor({app:r,onNoteSelect:n,excludeNotePaths:o,titleOnly:i=!1}){super(r);this.onNoteSelect=n,this.availableNotes=this.getOrderedNotes(o),this.titleOnly=i}getItems(){if(this.titleOnly){let r=new Map;return this.availableNotes.forEach(n=>{r.set(n.basename,n)}),Array.from(r.values())}return this.availableNotes}getItemText(r){let n=r.path===this.activeNote?.path;return this.formatNoteTitle(r.basename,n,r.extension)}onChooseItem(r,n){this.onNoteSelect(r)}renderSuggestion(r,n){let o=n.createDiv({cls:"pointer-events-none"});if(r.item instanceof RLt.TFile){let i=o.createDiv(),a=r.item;i.setText(this.formatNoteTitle(a.basename,a===this.activeNote,a.extension)),this.titleOnly||o.createDiv({cls:"mt-1 text-muted text-xs"}).setText(a.path)}}};var fie=class{constructor(e,r){this.app=e,this.onImagesSelected=r}open(){let e=document.createElement("input");e.type="file",e.accept="image/*",e.multiple=!0,e.style.display="none",e.addEventListener("change",()=>{let r=Array.from(e.files||[]);this.onImagesSelected(r),document.body.removeChild(e)}),document.body.appendChild(e),e.click()}};var AS=B(Z());var cAe=({capabilities:t=[],iconSize:e=16})=>AS.default.createElement(AS.default.Fragment,null,t.map((r,n)=>{switch(r){case"reasoning":return AS.default.createElement(iR,{key:n,className:"text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return AS.default.createElement(xx,{key:n,className:"text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return AS.default.createElement(oR,{key:n,className:"text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),dAe=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return AS.default.createElement("div",{className:"flex items-center gap-1"},AS.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&AS.default.createElement("div",{className:"flex gap-0.5 items-center"},AS.default.createElement(cAe,{capabilities:t.capabilities,iconSize:e})))};var fAe=t=>{let e=t.displayName||t.name,r=`(${Zm(t.provider,t)})`,n=t.capabilities?.map(o=>{switch(o){case"reasoning":return"Reasoning";case"vision":return"Vision";case"websearch":return"Websearch";default:return""}}).join("|")||"";return`${e}${r} ${n}`};var ILt=require("obsidian"),ly=class{constructor(){}static getInstance(){return ly.instance||(ly.instance=new ly),ly.instance}async processEmbeddedPDFs(e,r,n){let o=/!\[\[(.*?\.pdf)\]\]/g,i=[...e.matchAll(o)];for(let a of i){let s=a[1],u=r.getAbstractFileByPath(s);if(u instanceof ILt.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
Embedded PDF (${s}):
${l}
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
Embedded PDF (${s}): [Error: Could not process PDF]
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u=await e.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(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}};var F$=require("obsidian"),tt=B(Z());var Vr=B(Z()),Yo=B($Lt());function TM(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}var _ln=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 LD(t,e,r){let n=vln(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&qLt(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),qLt(n,"relativePath",i),n}function vln(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=_ln.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function qLt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var wln=[".DS_Store","Thumbs.db"];function hAe(t){return TM(this,void 0,void 0,function*(){return pie(t)&&Sln(t.dataTransfer)?Eln(t.dataTransfer,t.type):xln(t)?Cln(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?Oln(t):[]})}function Sln(t){return pie(t)}function xln(t){return pie(t)&&pie(t.target)}function pie(t){return typeof t=="object"&&t!==null}function Cln(t){return pAe(t.target.files).map(e=>LD(e))}function Oln(t){return TM(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>LD(r))})}function Eln(t,e){return TM(this,void 0,void 0,function*(){if(t.items){let r=pAe(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(Pln));return ULt(HLt(n))}return ULt(pAe(t.files).map(r=>LD(r)))})}function ULt(t){return t.filter(e=>wln.indexOf(e.name)===-1)}function pAe(t){if(t===null)return[];let e=[];for(let r=0;r<t.length;r++){let n=t[r];e.push(n)}return e}function Pln(t){if(typeof t.webkitGetAsEntry!="function")return zLt(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?VLt(e):zLt(t,e)}function HLt(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?HLt(r):[r]],[])}function zLt(t,e){return TM(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof t.getAsFileSystemHandle=="function"){let i=yield t.getAsFileSystemHandle();if(i===null)throw new Error(`${t} is not a File`);if(i!==void 0){let a=yield i.getFile();return a.handle=i,LD(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return LD(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function Tln(t){return TM(this,void 0,void 0,function*(){return t.isDirectory?VLt(t):Mln(t)})}function VLt(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>TM(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(Tln));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function Mln(t){return TM(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=LD(n,t.fullPath);e(o)},n=>{r(n)})})})}var hie=B(WLt());function JLt(t){return Iln(t)||Rln(t)||QLt(t)||Aln()}function Aln(){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 Rln(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Iln(t){if(Array.isArray(t))return gAe(t)}function GLt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function KLt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?GLt(Object(r),!0).forEach(function(n){ZLt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):GLt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ZLt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O6(t,e){return Nln(t)||jln(t,e)||QLt(t,e)||Dln()}function Dln(){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 QLt(t,e){if(t){if(typeof t=="string")return gAe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gAe(t,e)}}function gAe(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function jln(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function Nln(t){if(Array.isArray(t))return t}var Lln=typeof hie.default=="function"?hie.default:hie.default.default,Fln="file-invalid-type",kln="file-too-large",Bln="file-too-small",$ln="too-many-files";var qln=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:Fln,message:"File type must be ".concat(n)}},YLt=function(e){return{code:kln,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},XLt=function(e){return{code:Bln,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},eFt={code:$ln,message:"Too many files"};function yAe(t,e){var r=t.type==="application/x-moz-file"||Lln(t,e);return[r,r?null:qln(e)]}function bAe(t,e,r){if(FD(t.size))if(FD(e)&&FD(r)){if(t.size>r)return[!1,YLt(r)];if(t.size<e)return[!1,XLt(e)]}else{if(FD(e)&&t.size<e)return[!1,XLt(e)];if(FD(r)&&t.size>r)return[!1,YLt(r)]}return[!0,null]}function FD(t){return t!=null}function tFt(t){var e=t.files,r=t.accept,n=t.minSize,o=t.maxSize,i=t.multiple,a=t.maxFiles,s=t.validator;return!i&&e.length>1||i&&a>=1&&e.length>a?!1:e.every(function(u){var l=yAe(u,r),c=O6(l,1),d=c[0],f=bAe(u,n,o),p=O6(f,1),h=p[0],m=s?s(u):null;return d&&h&&!m})}function E6(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function P6(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function _Ae(t){t.preventDefault()}function Uln(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function zln(t){return t.indexOf("Edge/")!==-1}function rFt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Uln(t)||zln(t)}function cy(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return e.some(function(s){return!E6(n)&&s&&s.apply(void 0,[n].concat(i)),E6(n)})}}function nFt(){return"showOpenFilePicker"in window}function oFt(t){if(FD(t)){var e=Object.entries(t).filter(function(r){var n=O6(r,2),o=n[0],i=n[1],a=!0;return uFt(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(lFt))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=O6(n,2),i=o[0],a=o[1];return KLt(KLt({},r),{},ZLt({},i,a))},{});return[{description:"Files",accept:e}]}return t}function iFt(t){if(FD(t))return Object.entries(t).reduce(function(e,r){var n=O6(r,2),o=n[0],i=n[1];return[].concat(JLt(e),[o],JLt(i))},[]).filter(function(e){return uFt(e)||lFt(e)}).join(",")}function aFt(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function sFt(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function uFt(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function lFt(t){return/^.*\.[\w]+$/.test(t)}var Hln=["children"],Vln=["open"],Wln=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Jln=["refKey","onChange","onClick"];function Gln(t){return Xln(t)||Yln(t)||fFt(t)||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(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Xln(t){if(Array.isArray(t))return wAe(t)}function vAe(t,e){return ecn(t)||Qln(t,e)||fFt(t,e)||Zln()}function Zln(){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 fFt(t,e){if(t){if(typeof t=="string")return wAe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wAe(t,e)}}function wAe(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qln(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function ecn(t){if(Array.isArray(t))return t}function cFt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Ma(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cFt(Object(r),!0).forEach(function(n){SAe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cFt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function SAe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mie(t,e){if(t==null)return{};var r=tcn(t,e),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function tcn(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i<n.length;i++)o=n[i],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}var CAe=(0,Vr.forwardRef)(function(t,e){var r=t.children,n=mie(t,Hln),o=OAe(n),i=o.open,a=mie(o,Vln);return(0,Vr.useImperativeHandle)(e,function(){return{open:i}},[i]),Vr.default.createElement(Vr.Fragment,null,r(Ma(Ma({},a),{},{open:i})))});CAe.displayName="Dropzone";var pFt={disabled:!1,getFilesFromEvent:hAe,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};CAe.defaultProps=pFt;CAe.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 xAe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function OAe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Ma(Ma({},pFt),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,h=e.onDropRejected,m=e.onFileDialogCancel,v=e.onFileDialogOpen,g=e.useFsAccessApi,_=e.autoFocus,S=e.preventDropOnDocument,x=e.noClick,O=e.noKeyboard,T=e.noDrag,E=e.noDragEventsBubbling,M=e.onError,R=e.validator,N=(0,Vr.useMemo)(function(){return iFt(r)},[r]),j=(0,Vr.useMemo)(function(){return oFt(r)},[r]),k=(0,Vr.useMemo)(function(){return typeof v=="function"?v:dFt},[v]),F=(0,Vr.useMemo)(function(){return typeof m=="function"?m:dFt},[m]),L=(0,Vr.useRef)(null),q=(0,Vr.useRef)(null),U=(0,Vr.useReducer)(rcn,xAe),G=vAe(U,2),V=G[0],I=G[1],H=V.isFocused,W=V.isFileDialogActive,J=(0,Vr.useRef)(typeof window<"u"&&window.isSecureContext&&g&&nFt()),re=function(){!J.current&&W&&setTimeout(function(){if(q.current){var Xe=q.current.files;Xe.length||(I({type:"closeDialog"}),F())}},300)};(0,Vr.useEffect)(function(){return window.addEventListener("focus",re,!1),function(){window.removeEventListener("focus",re,!1)}},[q,W,F,J]);var Ae=(0,Vr.useRef)([]),Y=function(Xe){L.current&&L.current.contains(Xe.target)||(Xe.preventDefault(),Ae.current=[])};(0,Vr.useEffect)(function(){return S&&(document.addEventListener("dragover",_Ae,!1),document.addEventListener("drop",Y,!1)),function(){S&&(document.removeEventListener("dragover",_Ae),document.removeEventListener("drop",Y))}},[L,S]),(0,Vr.useEffect)(function(){return!n&&_&&L.current&&L.current.focus(),function(){}},[L,_,n]);var Q=(0,Vr.useCallback)(function(Ie){M?M(Ie):console.error(Ie)},[M]),le=(0,Vr.useCallback)(function(Ie){Ie.preventDefault(),Ie.persist(),qt(Ie),Ae.current=[].concat(Gln(Ae.current),[Ie.target]),P6(Ie)&&Promise.resolve(o(Ie)).then(function(Xe){if(!(E6(Ie)&&!E)){var fr=Xe.length,Ze=fr>0&&tFt({files:Xe,accept:N,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:R}),$n=fr>0&&!Ze;I({isDragAccept:Ze,isDragReject:$n,isDragActive:!0,type:"setDraggedFiles"}),l&&l(Ie)}}).catch(function(Xe){return Q(Xe)})},[o,l,Q,E,N,a,i,s,u,R]),Re=(0,Vr.useCallback)(function(Ie){Ie.preventDefault(),Ie.persist(),qt(Ie);var Xe=P6(Ie);if(Xe&&Ie.dataTransfer)try{Ie.dataTransfer.dropEffect="copy"}catch{}return Xe&&d&&d(Ie),!1},[d,E]),gt=(0,Vr.useCallback)(function(Ie){Ie.preventDefault(),Ie.persist(),qt(Ie);var Xe=Ae.current.filter(function(Ze){return L.current&&L.current.contains(Ze)}),fr=Xe.indexOf(Ie.target);fr!==-1&&Xe.splice(fr,1),Ae.current=Xe,!(Xe.length>0)&&(I({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),P6(Ie)&&c&&c(Ie))},[L,c,E]),Se=(0,Vr.useCallback)(function(Ie,Xe){var fr=[],Ze=[];Ie.forEach(function($n){var na=yAe($n,N),hl=vAe(na,2),Fc=hl[0],km=hl[1],Bm=bAe($n,a,i),Da=vAe(Bm,2),th=Da[0],ep=Da[1],rh=R?R($n):null;if(Fc&&th&&!rh)fr.push($n);else{var gn=[km,ep];rh&&(gn=gn.concat(rh)),Ze.push({file:$n,errors:gn.filter(function($O){return $O})})}}),(!s&&fr.length>1||s&&u>=1&&fr.length>u)&&(fr.forEach(function($n){Ze.push({file:$n,errors:[eFt]})}),fr.splice(0)),I({acceptedFiles:fr,fileRejections:Ze,isDragReject:Ze.length>0,type:"setFiles"}),f&&f(fr,Ze,Xe),Ze.length>0&&h&&h(Ze,Xe),fr.length>0&&p&&p(fr,Xe)},[I,s,N,a,i,u,f,p,h,R]),ae=(0,Vr.useCallback)(function(Ie){Ie.preventDefault(),Ie.persist(),qt(Ie),Ae.current=[],P6(Ie)&&Promise.resolve(o(Ie)).then(function(Xe){E6(Ie)&&!E||Se(Xe,Ie)}).catch(function(Xe){return Q(Xe)}),I({type:"reset"})},[o,Se,Q,E]),ee=(0,Vr.useCallback)(function(){if(J.current){I({type:"openDialog"}),k();var Ie={multiple:s,types:j};window.showOpenFilePicker(Ie).then(function(Xe){return o(Xe)}).then(function(Xe){Se(Xe,null),I({type:"closeDialog"})}).catch(function(Xe){aFt(Xe)?(F(Xe),I({type:"closeDialog"})):sFt(Xe)?(J.current=!1,q.current?(q.current.value=null,q.current.click()):Q(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Q(Xe)});return}q.current&&(I({type:"openDialog"}),k(),q.current.value=null,q.current.click())},[I,k,F,g,Se,Q,j,s]),ye=(0,Vr.useCallback)(function(Ie){!L.current||!L.current.isEqualNode(Ie.target)||(Ie.key===" "||Ie.key==="Enter"||Ie.keyCode===32||Ie.keyCode===13)&&(Ie.preventDefault(),ee())},[L,ee]),Ue=(0,Vr.useCallback)(function(){I({type:"focus"})},[]),ft=(0,Vr.useCallback)(function(){I({type:"blur"})},[]),Je=(0,Vr.useCallback)(function(){x||(rFt()?setTimeout(ee,0):ee())},[x,ee]),cr=function(Xe){return n?null:Xe},Yr=function(Xe){return O?null:cr(Xe)},dr=function(Xe){return T?null:cr(Xe)},qt=function(Xe){E&&Xe.stopPropagation()},Uo=(0,Vr.useMemo)(function(){return function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Xe=Ie.refKey,fr=Xe===void 0?"ref":Xe,Ze=Ie.role,$n=Ie.onKeyDown,na=Ie.onFocus,hl=Ie.onBlur,Fc=Ie.onClick,km=Ie.onDragEnter,Bm=Ie.onDragOver,Da=Ie.onDragLeave,th=Ie.onDrop,ep=mie(Ie,Wln);return Ma(Ma(SAe({onKeyDown:Yr(cy($n,ye)),onFocus:Yr(cy(na,Ue)),onBlur:Yr(cy(hl,ft)),onClick:cr(cy(Fc,Je)),onDragEnter:dr(cy(km,le)),onDragOver:dr(cy(Bm,Re)),onDragLeave:dr(cy(Da,gt)),onDrop:dr(cy(th,ae)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},fr,L),!n&&!O?{tabIndex:0}:{}),ep)}},[L,ye,Ue,ft,Je,le,Re,gt,ae,O,T,n]),ra=(0,Vr.useCallback)(function(Ie){Ie.stopPropagation()},[]),Fo=(0,Vr.useMemo)(function(){return function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Xe=Ie.refKey,fr=Xe===void 0?"ref":Xe,Ze=Ie.onChange,$n=Ie.onClick,na=mie(Ie,Jln),hl=SAe({accept:N,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:cr(cy(Ze,ae)),onClick:cr(cy($n,ra)),tabIndex:-1},fr,q);return Ma(Ma({},hl),na)}},[q,r,s,ae,n]);return Ma(Ma({},V),{},{isFocused:H&&!n,getRootProps:Uo,getInputProps:Fo,rootRef:L,inputRef:q,open:cr(ee)})}function rcn(t,e){switch(e.type){case"focus":return Ma(Ma({},t),{},{isFocused:!0});case"blur":return Ma(Ma({},t),{},{isFocused:!1});case"openDialog":return Ma(Ma({},xAe),{},{isFileDialogActive:!0});case"closeDialog":return Ma(Ma({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ma(Ma({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Ma(Ma({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Ma({},xAe);default:return t}}function dFt(){}var gFt=B(Z());var ji=B(Z());var gie=B(Z());var ncn=PN("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"}}),Rm=gie.forwardRef(({className:t,variant:e,...r},n)=>gie.createElement("div",{ref:n,className:Te(ncn({variant:e}),t),...r}));Rm.displayName="Badge";function hFt({note:t,isActive:e=!1,onRemoveContext:r}){return ji.default.createElement(Rm,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},ji.default.createElement("div",{className:"flex items-center gap-1"},ji.default.createElement("span",{className:"max-w-40 truncate"},t.basename),e&&ji.default.createElement("span",{className:"text-xs text-faint"},"Current"),t.extension==="pdf"&&ji.default.createElement("span",{className:"text-xs text-faint"},"pdf")),ji.default.createElement(Ge,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},ji.default.createElement(Ch,{className:"size-4"})))}function ocn({url:t,onRemoveUrl:e}){return ji.default.createElement(Rm,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},ji.default.createElement("div",{className:"flex items-center gap-1"},ji.default.createElement("span",{className:"max-w-40 truncate"},t),ji.default.createElement("span",{className:"text-xs text-faint"},"Link")),ji.default.createElement(Ge,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},ji.default.createElement(Ch,{className:"size-4"})))}var mFt=({activeNote:t,contextNotes:e,contextUrls:r,onAddContext:n,onRemoveContext:o,onRemoveUrl:i})=>{let a=ji.default.useMemo(()=>{let l=new Map(e.map(c=>[c.path,c]));return Array.from(l.values()).filter(c=>c.wasAddedManually?!0:!(t&&c.path===t.path))},[e,t]),s=ji.default.useMemo(()=>Array.from(new Set(r)),[r]),u=a.length>0||s.length>0||!!t;return ji.default.createElement("div",{className:"flex items-center w-full gap-1"},ji.default.createElement("div",{className:"flex items-start h-full"},ji.default.createElement(Ge,{onClick:n,variant:"ghost2",size:"fit",className:"border border-border border-solid rounded-sm ml-1"},ji.default.createElement(aR,{className:"size-4"}),!u&&ji.default.createElement("span",{className:"text-xs leading-4 pr-1"},"Add context"))),ji.default.createElement("div",{className:"flex gap-1 flex-wrap flex-1"},t&&ji.default.createElement(hFt,{key:t.path,note:t,isActive:!0,onRemoveContext:o}),a.map(l=>ji.default.createElement(hFt,{key:l.path,note:l,isActive:!1,onRemoveContext:o})),s.map(l=>ji.default.createElement(ocn,{key:l,url:l,onRemoveUrl:i}))))};var icn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u})=>{let[l]=jy(),c=()=>{new PM({app:t,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:e}).open()},d=f=>{let p=r.find(m=>m.path===f);p&&p.wasAddedManually?n(m=>m.filter(v=>v.path!==f)):(i(!1),n(m=>m.filter(v=>v.path!==f)))};return l!=="copilot_plus"?null:gFt.default.createElement(mFt,{activeNote:o?a:null,contextNotes:r,onAddContext:c,onRemoveContext:d,contextUrls:s,onRemoveUrl:u})},yFt=icn;var bFt=(0,tt.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,navigateHistory:a,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,mention:d,selectedImages:f,onAddImage:p,setSelectedImages:h},m)=>{let[v,g]=(0,tt.useState)(-1),[_,S]=(0,tt.useState)(""),[x,O]=(0,tt.useState)(!1),[T,E]=(0,tt.useState)([]),M=(0,tt.useRef)(null),R=(0,tt.useRef)(null),[N,j]=i9(),[k,F]=(0,tt.useState)(null),[L]=jy(),[q,U]=(0,tt.useState)(i.workspace.getActiveFile()),G=Fa(),V=L==="copilot_plus";(0,tt.useImperativeHandle)(m,()=>({focus:()=>{M.current?.focus()}}));let I=ae=>{if(!V){r();return}r({toolCalls:ae?["@vault"]:[],contextNotes:s,urls:T})},H=async ae=>{let ee=ae.target.value,ye=ae.target.selectionStart;e(ee),W();let ft=d.extractAllUrls(ee).filter(Je=>!T.includes(Je));ft.length>0&&E(Je=>Array.from(new Set([...Je,...ft]))),ye>=2&&ee.slice(ye-2,ye)==="[["?J(ye):ee==="/"?re():ee.slice(-1)==="@"&&V&&Ae()},W=()=>{M.current&&(M.current.style.height="auto",M.current.style.height=`${M.current.scrollHeight}px`)};(0,tt.useEffect)(()=>{W()},[t]);let J=ae=>{(async()=>{let ye=ly.getInstance();new PM({app:i,onNoteSelect:async Ue=>{let ft=t.slice(0,ae-2),Je=t.slice(ae-1),Yr=Ple(Ue.basename,i.vault)?Ue.basename:Ue.path,dr=`${ft}[[${Yr}]]${Je}`;e(dr);let qt=i.workspace.getActiveFile();Ue&&await ye.addNoteToContext(Ue,i.vault,s,qt,u,c),setTimeout(()=>{if(M.current){let Uo=ae+Yr.length+2;M.current.setSelectionRange(Uo,Uo)}},0)},excludeNotePaths:Se}).open()})()},re=async()=>{let ae=Yf.getInstance(i.vault),ee=await ae.getAllPrompts(),ye=ee.map(Ue=>Ue.title);new vO(i,ye,async Ue=>{let ft=ee.find(Je=>Je.title===Ue);ft&&(ae.recordPromptUsage(ft.title),e(ft.content))}).open()},Ae=()=>{let ae=XH.map(ee=>({title:ee,description:QAt(ee)}));new vO(i,ae.map(ee=>ee.title),ee=>{e(t+ee+" ")},ae.map(ee=>ee.description)).open()},Y=ae=>{if(ae.nativeEvent.isComposing)return;let ee=M.current;if(!ee)return;let{selectionStart:ye,value:Ue}=ee,ft=Ue.split(`
`),Je=Ue.substring(0,ye).split(`
`).length-1;if(ae.key==="Enter"&&ae.shiftKey&&(F$.Platform.isMacOS?ae.metaKey:ae.ctrlKey)){ae.preventDefault(),ae.stopPropagation(),I(!0),g(-1),S("");return}if(ae.key==="Enter"&&!ae.shiftKey)ae.preventDefault(),I(!1),g(-1),S("");else if(ae.key==="ArrowUp"){if(Je>0||ye>0)return;ae.preventDefault(),v===-1&&Ue.trim()!==""&&S(Ue);let cr=a("up");cr!==t&&(g(v+1),e(cr),setTimeout(()=>{ee&&(ee.selectionStart=ee.selectionEnd=0)},0))}else if(ae.key==="ArrowDown"){if(Je<ft.length-1||ye<Ue.length)return;if(ae.preventDefault(),v>-1){let cr=a("down");g(v-1),e(v===0?_:cr),setTimeout(()=>{ee&&(ee.selectionStart=ee.selectionEnd=0)},0)}}},Q=(0,tt.useCallback)(async ae=>{let ee=ae.clipboardData?.items;if(!ee||!V)return;let ye=Array.from(ee).filter(Ue=>Ue.type.indexOf("image")!==-1);if(ye.length>0){ae.preventDefault();let ft=(await Promise.all(ye.map(Je=>{let cr=Je.getAsFile();return cr||null}))).filter(Je=>Je!==null);ft.length>0&&p(ft)}},[p,V]);(0,tt.useEffect)(()=>{let ae=new Set(Ry(t,i.vault)),ee=d.extractAllUrls(t);u(ye=>ye.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(ye=>ye.filter(Ue=>ee.includes(Ue)))},[t,l,q,d,u,i.vault]),(0,tt.useEffect)(()=>{let ae,ee=()=>{clearTimeout(ae),ae=setTimeout(()=>{let Ue=i.workspace.getActiveFile();U(Ue)},100)},ye=i.workspace.on("active-leaf-change",ee);return()=>{clearTimeout(ae),i.workspace.offref(ye)}},[i.workspace]);let{getRootProps:le,getInputProps:Re,isDragActive:gt}=OAe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:ae=>{p(ae)},noClick:!0,noDragEventsBubbling:!0}),Se=(0,tt.useMemo)(()=>[...s.map(ae=>ae.path),...l&&q?[q.path]:[]].filter(ae=>ae!=null),[s,l,q]);return tt.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",ref:R},tt.default.createElement(yFt,{app:i,excludeNotePaths:Se,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,activeNote:q,contextUrls:T,onRemoveUrl:ae=>E(ee=>ee.filter(ye=>ye!==ae))}),f.length>0&&tt.default.createElement("div",{className:"selected-images"},f.map((ae,ee)=>tt.default.createElement("div",{key:ee,className:"image-preview-container"},tt.default.createElement("img",{src:URL.createObjectURL(ae),alt:ae.name,className:"selected-image-preview"}),tt.default.createElement("button",{className:"remove-image-button",onClick:()=>h(ye=>ye.filter((Ue,ft)=>ft!==ee)),title:"Remove image"},tt.default.createElement(Ch,{className:"size-4"}))))),tt.default.createElement("div",{className:"relative",...V?le():{}},tt.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:t,onChange:H,onKeyDown:Y,onPaste:Q}),V&&tt.default.createElement(tt.default.Fragment,null,tt.default.createElement("input",{...Re()}),gt&&tt.default.createElement("div",{className:"absolute inset-0 bg-primary border border-dashed border-primary rounded-md flex items-center justify-center"},tt.default.createElement("span",{className:"text-primary"},"Drop images here...")))),tt.default.createElement("div",{className:"flex gap-1 justify-between px-1"},tt.default.createElement("div",{className:"flex items-center gap-1"},tt.default.createElement(nie,{open:x,onOpenChange:O},tt.default.createElement(oie,{asChild:!0},tt.default.createElement(Ge,{variant:"ghost2",size:"fit"},k?tt.default.createElement("span",{className:"text-error"},"Model Load Failed"):G.activeModels.find(ae=>ae.enabled&&an(ae)===N)?tt.default.createElement(dAe,{model:G.activeModels.find(ae=>ae.enabled&&an(ae)===N),iconSize:8}):"Select Model",tt.default.createElement(Sl,{className:"size-5 mt-0.5"}))),tt.default.createElement(OM,{align:"start"},G.activeModels.filter(ae=>ae.enabled).map(ae=>{let{hasApiKey:ee,errorNotice:ye}=W5(ae,G);return tt.default.createElement(Tc,{key:an(ae),onSelect:async Ue=>{if(!ee&&ye){Ue.preventDefault(),new F$.Notice(ye);return}try{F(null),j(an(ae))}catch(ft){let Je="Model switch failed: "+ia(ft);F(Je),new F$.Notice(Je);let cr=G.activeModels.find(Yr=>Yr.enabled&&an(Yr)===N);cr&&j(an(cr))}},className:ee?"":"opacity-50 cursor-not-allowed"},tt.default.createElement(dAe,{model:ae,iconSize:12}))}))),V&&tt.default.createElement(Ge,{variant:"ghost2",size:"fit",onClick:()=>{new fie(i,p).open()}},tt.default.createElement("div",{className:"flex items-center gap-1"},tt.default.createElement("span",null,"image"),tt.default.createElement(_z,{className:"!size-3"})))),tt.default.createElement("div",{className:"flex items-center gap-1"},n&&tt.default.createElement(Ge,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>o()},tt.default.createElement(BE,{className:"size-4"})),tt.default.createElement(Ge,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>I(!1)},tt.default.createElement(tR,{className:"!size-3"}),tt.default.createElement("span",null,"chat")),L==="copilot_plus"&&tt.default.createElement(Ge,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>I(!0)},tt.default.createElement("div",{className:"flex items-center gap-1"},F$.Platform.isMacOS?tt.default.createElement("div",{className:"flex items-center"},tt.default.createElement(fz,{className:"!size-3"}),tt.default.createElement(AN,{className:"!size-3"}),tt.default.createElement(tR,{className:"!size-3"})):tt.default.createElement("div",{className:"flex items-center"},tt.default.createElement("span",null,"Ctrl"),tt.default.createElement(AN,{className:"size-4"}),tt.default.createElement(tR,{className:"!size-3"})),tt.default.createElement("span",null,"vault"))))))});bFt.displayName="ChatInput";var _Ft=bFt;var vFt=require("obsidian");var Er=B(Z()),wFt=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Er.default.createElement("div",{className:Te("flex",{"group-hover:opacity-100 opacity-0":!vFt.Platform.isMobile})},Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Er.default.createElement(cg,{className:"size-4"}):Er.default.createElement(eR,{className:"size-4"}))),Er.default.createElement(Hr,null,"Copy")),t.sender===Ao?Er.default.createElement(Er.default.Fragment,null,Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Er.default.createElement(Sf,{className:"size-4"}))),Er.default.createElement(Hr,null,"Edit")),Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Er.default.createElement(Cx,{className:"size-4"}))),Er.default.createElement(Hr,null,"Delete"))):Er.default.createElement(Er.default.Fragment,null,u&&Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Er.default.createElement(Sz,{className:"size-4"}))),Er.default.createElement(Hr,null,"Show Sources")),Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:n,variant:"ghost2",size:"fit",title:"Insert to note at cursor"},Er.default.createElement(Tz,{className:"size-4"}))),Er.default.createElement(Hr,null,"Insert to note at cursor")),Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Er.default.createElement(Ez,{className:"size-4"}))),Er.default.createElement(Hr,null,"Regenerate")),Er.default.createElement(Jr,null,Er.default.createElement(Gr,{asChild:!0},Er.default.createElement(Ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Er.default.createElement(Cx,{className:"size-4"}))),Er.default.createElement(Hr,null,"Delete"))));var SFt=require("obsidian"),yie=class extends SFt.Modal{constructor(r,n){super(r);this.sources=n}onOpen(){let{contentEl:r}=this;r.empty(),r.createEl("h2",{text:"Sources"});let n=this.sources.filter(i=>i.score>=Ale),o=this.sources.filter(i=>i.score<Ale);n.length>0&&(r.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(r,n)),o.length>0&&(r.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(r,o))}createSourceList(r,n){let o=r.createEl("ul");o.style.listStyleType="none",o.style.padding="0",n.forEach(i=>{let a=o.createEl("li");a.style.marginBottom="1em",a.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(i.title)}`,text:i.title}).addEventListener("click",u=>{u.preventDefault(),this.app.workspace.openLinkText(i.title,"")}),i.score&&i.score<=1&&a.appendChild(document.createTextNode(` - Relevance score: ${i.score.toFixed(3)}`))})}onClose(){let{contentEl:r}=this;r.empty()}};var bie=require("obsidian"),Xt=B(Z());function acn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:Xt.default.createElement("div",{className:"flex gap-2 flex-wrap"},t.notes.map(e=>Xt.default.createElement(Jr,{key:e.path},Xt.default.createElement(Gr,{asChild:!0},Xt.default.createElement(Rm,{variant:"secondary"},Xt.default.createElement("span",{className:"max-w-40 truncate"},e.basename))),Xt.default.createElement(Hr,null,e.path))),t.urls.map(e=>Xt.default.createElement(Jr,{key:e},Xt.default.createElement(Gr,{asChild:!0},Xt.default.createElement(Rm,{variant:"secondary"},Xt.default.createElement("span",{className:"max-w-40 truncate"},e))),Xt.default.createElement(Hr,null,e))))}var scn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,Xt.useState)(!1),[u,l]=(0,Xt.useState)(!1),[c,d]=(0,Xt.useState)(t.message),f=(0,Xt.useRef)(null),p=(0,Xt.useRef)(null),h=(0,Xt.useRef)(null),m=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},v=(0,Xt.useCallback)(R=>{let N=e.workspace.getActiveFile(),j=N?N.path:"",k=I=>{let H="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",W="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",J="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&I.includes("<think>"))return I=I.replace(/<think>([\s\S]*?)<\/think>/g,(Ae,Y)=>`<details style="${H}">
<summary style="${W}">Thought for a second</summary>
<div class="text-muted" style="${J}">${Y.trim()}</div>
</details>
`),I=I.replace(/<think>([\s\S]*)$/,(Ae,Y)=>`<div style="${H}">
<div style="${W}">Thinking...</div>
<div class="text-muted" style="${J}">${Y.trim()}</div>
</div>`),I;let re=/<think>([\s\S]*?)<\/think>/g;return I.replace(re,(Ae,Y)=>`<details style="${H}">
<summary style="${W}">Thought for a second</summary>
<div class="text-muted" style="${J}">${Y.trim()}</div>
</details>
`)},F=(I,H,W)=>I.replace(H,(J,re)=>{let Ae=e.metadataCache.getFirstLinkpathDest(re,j);return Ae?W(Ae):J}),L=R.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),q=F(L,/!\[\[(.*?)]]/g,I=>`![](${e.vault.getResourcePath(I)})`),U=k(q),G=g(U);return F(G,/(?<!!)\[\[([^\]]+)]]/g,I=>`<a href="obsidian://open?file=${encodeURIComponent(I.path)}">${I.basename}</a>`)},[e,r]),g=R=>{let N=R.split(`
#### Sources:
`);if(N.length!==2)return R;let[j,k]=N,F=k.split(`
`).map(L=>{let q=L.match(/- \[\[(.*?)\]\]/);return q?`<li>[[${q[1]}]]</li>`:L}).join(`
`);return j+`
<br/>
<details><summary>Sources</summary>
<ul>
`+F+`
</ul>
</details>`};(0,Xt.useEffect)(()=>{if(f.current&&t.sender!==Ao){f.current.innerHTML="",p.current||(p.current=new bie.Component);let R=v(t.message);bie.MarkdownRenderer.renderMarkdown(R,f.current,"",p.current)}return()=>{p.current&&(p.current.unload(),p.current=null)}},[t,e,p,r,v]),(0,Xt.useEffect)(()=>{u&&h.current&&_(h.current)},[u]),(0,Xt.useEffect)(()=>{d(t.message)},[t.message]);let _=R=>{R.style.height="auto",R.style.height=`${R.scrollHeight}px`},S=R=>{d(R.target.value),_(R.target)},x=R=>{R.nativeEvent.isComposing||R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),T())},O=()=>{l(!0)},T=()=>{l(!1),o&&o(c)},E=()=>{t.sources&&t.sources.length>0&&new yie(e,t.sources).open()},M=()=>t.content?Xt.default.createElement("div",{className:"message-content-items"},t.content.map((R,N)=>R.type==="text"?Xt.default.createElement("div",{key:N,className:"message-text-content"},t.sender===Ao&&u?Xt.default.createElement("textarea",{ref:h,value:c,onChange:S,onKeyDown:x,onBlur:T,autoFocus:!0,className:"edit-textarea"}):t.sender===Ao?Xt.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},t.message):Xt.default.createElement("div",{ref:f,className:t.isErrorMessage?"text-error":""})):R.type==="image_url"?Xt.default.createElement("div",{key:N,className:"message-image-content"},Xt.default.createElement("img",{src:R.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Ao&&u?Xt.default.createElement("textarea",{ref:h,value:c,onChange:S,onKeyDown:x,onBlur:T,autoFocus:!0,className:"edit-textarea"}):t.sender===Ao?Xt.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},t.message):Xt.default.createElement("div",{ref:f,className:t.isErrorMessage?"text-error":""});return Xt.default.createElement("div",{className:"flex flex-col w-full my-1"},Xt.default.createElement("div",{className:Te("flex rounded-md p-2 mx-2 gap-2 group",t.sender===Ao&&"border border-border border-solid")},Xt.default.createElement("div",{className:"w-6 shrink-0"},t.sender===Ao?Xt.default.createElement(Mz,null):Xt.default.createElement(lz,null)),Xt.default.createElement("div",{className:"flex flex-col flex-grow max-w-full gap-2"},!u&&Xt.default.createElement(acn,{context:t.context}),Xt.default.createElement("div",{className:"message-content"},M()),!r&&Xt.default.createElement("div",{className:"flex justify-between items-center"},Xt.default.createElement("div",{className:"text-faint text-xs"},t.timestamp?.display),Xt.default.createElement(wFt,{message:t,onCopy:m,isCopied:a,onInsertIntoEditor:()=>cU(t.message),onRegenerate:n,onEdit:O,onDelete:i,onShowSources:E,hasSources:!!(t.sources&&t.sources.length>0)})))))},EAe=scn;var Ic=B(Z(),1);function xFt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var OFt=B(Z(),1);function CFt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function PAe(...t){return e=>{let r=!1,n=t.map(o=>{let i=CFt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():CFt(t[o],null)}}}}function EFt(...t){return OFt.useCallback(PAe(...t),t)}var PFt=B(Z(),1),fcn=B(_s(),1);var Rc=B(Z(),1);var k$=B(dt(),1),MAe=Rc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Rc.Children.toArray(r),i=o.find(lcn);if(i){let a=i.props.children,s=o.map(u=>u===i?Rc.Children.count(a)>1?Rc.Children.only(null):Rc.isValidElement(a)?a.props.children:null:u);return(0,k$.jsx)(TAe,{...n,ref:e,children:Rc.isValidElement(a)?Rc.cloneElement(a,void 0,s):null})}return(0,k$.jsx)(TAe,{...n,ref:e,children:r})});MAe.displayName="Slot";var TAe=Rc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Rc.isValidElement(r)){let o=dcn(r);return Rc.cloneElement(r,{...ccn(n,r.props),ref:e?PAe(e,o):o})}return Rc.Children.count(r)>1?Rc.Children.only(null):null});TAe.displayName="SlotClone";var ucn=({children:t})=>(0,k$.jsx)(k$.Fragment,{children:t});function lcn(t){return Rc.isValidElement(t)&&t.type===ucn}function ccn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function dcn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var TFt=B(dt(),1),pcn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_ie=pcn.reduce((t,e)=>{let r=PFt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?MAe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,TFt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var kD=B(dt(),1),AAe="Collapsible",[hcn,Z3o]=No(AAe),[mcn,RAe]=hcn(AAe),MFt=Ic.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=ll({prop:n,defaultProp:o,onChange:a});return(0,kD.jsx)(mcn,{scope:r,disabled:i,contentId:Ga(),open:u,onOpenToggle:Ic.useCallback(()=>l(c=>!c),[l]),children:(0,kD.jsx)(_ie.div,{"data-state":NAe(u),"data-disabled":i?"":void 0,...s,ref:e})})});MFt.displayName=AAe;var AFt="CollapsibleTrigger",IAe=Ic.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=RAe(AFt,r);return(0,kD.jsx)(_ie.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":NAe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:xFt(t.onClick,o.onOpenToggle)})});IAe.displayName=AFt;var DAe="CollapsibleContent",jAe=Ic.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=RAe(DAe,t.__scopeCollapsible);return(0,kD.jsx)($u,{present:r||o.open,children:({present:i})=>(0,kD.jsx)(gcn,{...n,ref:e,present:i})})});jAe.displayName=DAe;var gcn=Ic.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=RAe(DAe,r),[s,u]=Ic.useState(n),l=Ic.useRef(null),c=EFt(e,l),d=Ic.useRef(0),f=d.current,p=Ic.useRef(0),h=p.current,m=a.open||s,v=Ic.useRef(m),g=Ic.useRef(void 0);return Ic.useEffect(()=>{let _=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(_)},[]),qr(()=>{let _=l.current;if(_){g.current=g.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let S=_.getBoundingClientRect();d.current=S.height,p.current=S.width,v.current||(_.style.transitionDuration=g.current.transitionDuration,_.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,kD.jsx)(_ie.div,{"data-state":NAe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...i,ref:c,style:{["--radix-collapsible-content-height"]:f?`${f}px`:void 0,["--radix-collapsible-content-width"]:h?`${h}px`:void 0,...t.style},children:m&&o})});function NAe(t){return t?"open":"closed"}var RFt=MFt;var vie=RFt,wie=IAe,Sie=jAe;var I6=B(Z());var ea=B(Z(),1);function RS(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var DFt=B(Z(),1);function IFt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function LAe(...t){return e=>{let r=!1,n=t.map(o=>{let i=IFt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():IFt(t[o],null)}}}}function dy(...t){return DFt.useCallback(LAe(...t),t)}var Aa=B(Z(),1);var jFt=B(Z(),1),NFt=B(_s(),1);var Dc=B(Z(),1);var B$=B(dt(),1),T6=Dc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Dc.Children.toArray(r),i=o.find(_cn);if(i){let a=i.props.children,s=o.map(u=>u===i?Dc.Children.count(a)>1?Dc.Children.only(null):Dc.isValidElement(a)?a.props.children:null:u);return(0,B$.jsx)(FAe,{...n,ref:e,children:Dc.isValidElement(a)?Dc.cloneElement(a,void 0,s):null})}return(0,B$.jsx)(FAe,{...n,ref:e,children:r})});T6.displayName="Slot";var FAe=Dc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Dc.isValidElement(r)){let o=wcn(r);return Dc.cloneElement(r,{...vcn(n,r.props),ref:e?LAe(e,o):o})}return Dc.Children.count(r)>1?Dc.Children.only(null):null});FAe.displayName="SlotClone";var bcn=({children:t})=>(0,B$.jsx)(B$.Fragment,{children:t});function _cn(t){return Dc.isValidElement(t)&&t.type===bcn}function vcn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function wcn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var LFt=B(dt(),1),Scn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ef=Scn.reduce((t,e)=>{let r=jFt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?T6:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,LFt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function FFt(t,e){t&&NFt.flushSync(()=>t.dispatchEvent(e))}var BAe=B(dt(),1),xcn="DismissableLayer",kAe="dismissableLayer.update",Ccn="dismissableLayer.pointerDownOutside",Ocn="dismissableLayer.focusOutside",kFt,$Ft=Aa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$Ae=Aa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Aa.useContext($Ft),[c,d]=Aa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Aa.useState({}),h=dy(e,E=>d(E)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(v),_=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,O=Tcn(E=>{let M=E.target,R=[...l.branches].some(N=>N.contains(M));!x||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Mcn(E=>{let M=E.target;[...l.branches].some(N=>N.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return OS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Aa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(kFt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),BFt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=kFt)}},[c,f,r,l]),Aa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),BFt())},[c,l]),Aa.useEffect(()=>{let E=()=>p({});return document.addEventListener(kAe,E),()=>document.removeEventListener(kAe,E)},[]),(0,BAe.jsx)(ef.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:RS(t.onFocusCapture,T.onFocusCapture),onBlurCapture:RS(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:RS(t.onPointerDownCapture,O.onPointerDownCapture)})});$Ae.displayName=xcn;var Ecn="DismissableLayerBranch",Pcn=Aa.forwardRef((t,e)=>{let r=Aa.useContext($Ft),n=Aa.useRef(null),o=dy(e,n);return Aa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,BAe.jsx)(ef.div,{...t,ref:o})});Pcn.displayName=Ecn;function Tcn(t,e=globalThis?.document){let r=Gt(t),n=Aa.useRef(!1),o=Aa.useRef(()=>{});return Aa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){qFt(Ccn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Mcn(t,e=globalThis?.document){let r=Gt(t),n=Aa.useRef(!1);return Aa.useEffect(()=>{let o=i=>{i.target&&!n.current&&qFt(Ocn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function BFt(){let t=new CustomEvent(kAe);document.dispatchEvent(t)}function qFt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?FFt(o,i):o.dispatchEvent(i)}var Im=B(Z(),1);var WFt=B(dt(),1),qAe="focusScope.autoFocusOnMount",UAe="focusScope.autoFocusOnUnmount",UFt={bubbles:!1,cancelable:!0},Acn="FocusScope",zAe=Im.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Im.useState(null),l=Gt(o),c=Gt(i),d=Im.useRef(null),f=dy(e,m=>u(m)),p=Im.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Im.useEffect(()=>{if(n){let _=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:MM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||MM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&MM(s)};var m=_,v=S,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Im.useEffect(()=>{if(s){HFt.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(qAe,UFt);s.addEventListener(qAe,l),s.dispatchEvent(g),g.defaultPrevented||(Rcn(Lcn(JFt(s)),{select:!0}),document.activeElement===m&&MM(s))}return()=>{s.removeEventListener(qAe,l),setTimeout(()=>{let g=new CustomEvent(UAe,UFt);s.addEventListener(UAe,c),s.dispatchEvent(g),g.defaultPrevented||MM(m??document.body,{select:!0}),s.removeEventListener(UAe,c),HFt.remove(p)},0)}}},[s,l,c,p]);let h=Im.useCallback(m=>{if(!r&&!n||p.paused)return;let v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(v&&g){let _=m.currentTarget,[S,x]=Icn(_);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&MM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&MM(x,{select:!0})):g===_&&m.preventDefault()}},[r,n,p.paused]);return(0,WFt.jsx)(ef.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});zAe.displayName=Acn;function Rcn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(MM(n,{select:e}),document.activeElement!==r)return}function Icn(t){let e=JFt(t),r=zFt(e,t),n=zFt(e.reverse(),t);return[r,n]}function JFt(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function zFt(t,e){for(let r of t)if(!Dcn(r,{upTo:e}))return r}function Dcn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function jcn(t){return t instanceof HTMLInputElement&&"select"in t}function MM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&jcn(t)&&e&&t.select()}}var HFt=Ncn();function Ncn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=VFt(t,e),t.unshift(e)},remove(e){t=VFt(t,e),t[0]?.resume()}}}function VFt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Lcn(t){return t.filter(e=>e.tagName!=="A")}var Kp=B(Z(),1);var GFt=B(Z(),1);var HAe=B(dt(),1),Fcn="Arrow",KFt=GFt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,HAe.jsx)(ef.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,HAe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});KFt.displayName=Fcn;var YFt=KFt;var AM=B(dt(),1);var VAe="Popper",[XFt,WAe]=No(VAe),[Bcn,ZFt]=XFt(VAe),QFt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Kp.useState(null);return(0,AM.jsx)(Bcn,{scope:e,anchor:n,onAnchorChange:o,children:r})};QFt.displayName=VAe;var ekt="PopperAnchor",tkt=Kp.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=ZFt(ekt,r),a=Kp.useRef(null),s=dy(e,a);return Kp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,AM.jsx)(ef.div,{...o,ref:s})});tkt.displayName=ekt;var JAe="PopperContent",[$cn,qcn]=XFt(JAe),rkt=Kp.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=t,v=ZFt(JAe,r),[g,_]=Kp.useState(null),S=dy(e,le=>_(le)),[x,O]=Kp.useState(null),T=Tm(x),E=T?.width??0,M=T?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],k=j.length>0,F={padding:N,boundary:j.filter(zcn),altBoundary:k},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=dM({strategy:"fixed",placement:R,whileElementsMounted:(...le)=>xO(...le,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[fM({mainAxis:o+M,alignmentAxis:a}),u&&pM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hM():void 0,...F}),u&&mM({...F}),gM({...F,apply:({elements:le,rects:Re,availableWidth:gt,availableHeight:Se})=>{let{width:ae,height:ee}=Re.reference,ye=le.floating.style;ye.setProperty("--radix-popper-available-width",`${gt}px`),ye.setProperty("--radix-popper-available-height",`${Se}px`),ye.setProperty("--radix-popper-anchor-width",`${ae}px`),ye.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&bM({element:x,padding:s}),Hcn({arrowWidth:E,arrowHeight:M}),f&&yM({strategy:"referenceHidden",...F})]}),[I,H]=ikt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,re=V.arrow?.y,Ae=V.arrow?.centerOffset!==0,[Y,Q]=Kp.useState();return qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,AM.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,["--radix-popper-transform-origin"]:[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,AM.jsx)($cn,{scope:r,placedSide:I,onArrowChange:O,arrowX:J,arrowY:re,shouldHideArrow:Ae,children:(0,AM.jsx)(ef.div,{"data-side":I,"data-align":H,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});rkt.displayName=JAe;var nkt="PopperArrow",Ucn={top:"bottom",right:"left",bottom:"top",left:"right"},okt=Kp.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=qcn(nkt,n),a=Ucn[i.placedSide];return(0,AM.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,AM.jsx)(YFt,{...o,ref:r,style:{...o.style,display:"block"}})})});okt.displayName=nkt;function zcn(t){return t!==null}var Hcn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=ikt(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 ikt(t){let[e,r="center"]=t.split("-");return[e,r]}var akt=QFt,GAe=tkt,skt=rkt,ukt=okt;var xie=B(Z(),1),lkt=B(_s(),1);var ckt=B(dt(),1),Wcn="Portal",KAe=xie.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=xie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?lkt.default.createPortal((0,ckt.jsx)(ef.div,{...n,ref:e}),a):null});KAe.displayName=Wcn;var Eie=B(Z());var yd=B(Z());var Cie=RD();var YAe=function(){},M6=yd.forwardRef(function(t,e){var r=yd.useRef(null),n=yd.useState({onScrollCapture:YAe,onWheelCapture:YAe,onTouchMoveCapture:YAe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,h=t.inert,m=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,S=xM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=AD([r,e]),T=Lo(Lo({},S),o);return yd.createElement(yd.Fragment,null,c&&yd.createElement(x,{sideCar:Cie,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?yd.cloneElement(yd.Children.only(s),Lo(Lo({},T),{ref:O})):yd.createElement(g,Lo({},T,{className:u,ref:O}),s))});M6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};M6.classNames={fullWidth:sy,zeroRight:ay};var Ni=B(Z());var XAe=!1;if(typeof window<"u")try{A6=Object.defineProperty({},"passive",{get:function(){return XAe=!0,!0}}),window.addEventListener("test",A6,A6),window.removeEventListener("test",A6,A6)}catch{XAe=!1}var A6,BD=XAe?{passive:!1}:!1;var Jcn=function(t){return t.tagName==="TEXTAREA"},dkt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Jcn(t)&&r[e]==="visible")},Gcn=function(t){return dkt(t,"overflowY")},Kcn=function(t){return dkt(t,"overflowX")},ZAe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=fkt(t,n);if(o){var i=pkt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Ycn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Xcn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},fkt=function(t,e){return t==="v"?Gcn(e):Kcn(e)},pkt=function(t,e){return t==="v"?Ycn(e):Xcn(e)},Zcn=function(t,e){return t==="h"&&e==="rtl"?-1:1},hkt=function(t,e,r,n,o){var i=Zcn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=pkt(t,s),h=p[0],m=p[1],v=p[2],g=m-v-i*h;(h||g)&&fkt(t,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Oie=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},mkt=function(t){return[t.deltaX,t.deltaY]},gkt=function(t){return t&&"current"in t?t.current:t},Qcn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},edn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},tdn=0,$$=[];function ykt(t){var e=Ni.useRef([]),r=Ni.useRef([0,0]),n=Ni.useRef(),o=Ni.useState(tdn++)[0],i=Ni.useState(CO)[0],a=Ni.useRef(t);Ni.useEffect(function(){a.current=t},[t]),Ni.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=A$([t.lockRef.current],(t.shards||[]).map(gkt),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Ni.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=Oie(m),_=r.current,S="deltaX"in m?m.deltaX:_[0]-g[0],x="deltaY"in m?m.deltaY:_[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=ZAe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=ZAe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var R=n.current||O;return hkt(R,v,m,R==="h"?S:x,!0)},[]),u=Ni.useCallback(function(m){var v=m;if(!(!$$.length||$$[$$.length-1]!==i)){var g="deltaY"in v?mkt(v):Oie(v),_=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&Qcn(O.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var S=(a.current.shards||[]).map(gkt).filter(Boolean).filter(function(O){return O.contains(v.target)}),x=S.length>0?s(v,S[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=Ni.useCallback(function(m,v,g,_){var S={name:m,delta:v,target:g,should:_,shadowParent:rdn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=Ni.useCallback(function(m){r.current=Oie(m),n.current=void 0},[]),d=Ni.useCallback(function(m){l(m.type,mkt(m),m.target,s(m,t.lockRef.current))},[]),f=Ni.useCallback(function(m){l(m.type,Oie(m),m.target,s(m,t.lockRef.current))},[]);Ni.useEffect(function(){return $$.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,BD),document.addEventListener("touchmove",u,BD),document.addEventListener("touchstart",c,BD),function(){$$=$$.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,BD),document.removeEventListener("touchmove",u,BD),document.removeEventListener("touchstart",c,BD)}},[]);var p=t.removeScrollBar,h=t.inert;return Ni.createElement(Ni.Fragment,null,h?Ni.createElement(i,{styles:edn(o)}):null,p?Ni.createElement(DD,{gapMode:t.gapMode}):null)}function rdn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var bkt=ID(Cie,ykt);var _kt=Eie.forwardRef(function(t,e){return Eie.createElement(M6,Lo({},t,{ref:e,sideCar:bkt}))});_kt.classNames=M6.classNames;var QAe=_kt;var Uu=B(dt(),1),eRe="Popover",[vkt,pHo]=No(eRe,[WAe]),R6=WAe(),[ndn,RM]=vkt(eRe),wkt=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=R6(e),u=ea.useRef(null),[l,c]=ea.useState(!1),[d=!1,f]=ll({prop:n,defaultProp:o,onChange:i});return(0,Uu.jsx)(akt,{...s,children:(0,Uu.jsx)(ndn,{scope:e,contentId:Ga(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:ea.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:ea.useCallback(()=>c(!0),[]),onCustomAnchorRemove:ea.useCallback(()=>c(!1),[]),modal:a,children:r})})};wkt.displayName=eRe;var Skt="PopoverAnchor",odn=ea.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RM(Skt,r),i=R6(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return ea.useEffect(()=>(a(),()=>s()),[a,s]),(0,Uu.jsx)(GAe,{...i,...n,ref:e})});odn.displayName=Skt;var xkt="PopoverTrigger",Ckt=ea.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RM(xkt,r),i=R6(r),a=dy(e,o.triggerRef),s=(0,Uu.jsx)(ef.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Mkt(o.open),...n,ref:a,onClick:RS(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Uu.jsx)(GAe,{asChild:!0,...i,children:s})});Ckt.displayName=xkt;var tRe="PopoverPortal",[idn,adn]=vkt(tRe,{forceMount:void 0}),Okt=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=RM(tRe,e);return(0,Uu.jsx)(idn,{scope:e,forceMount:r,children:(0,Uu.jsx)($u,{present:r||i.open,children:(0,Uu.jsx)(KAe,{asChild:!0,container:o,children:n})})})};Okt.displayName=tRe;var q$="PopoverContent",Ekt=ea.forwardRef((t,e)=>{let r=adn(q$,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=RM(q$,t.__scopePopover);return(0,Uu.jsx)($u,{present:n||i.open,children:i.modal?(0,Uu.jsx)(sdn,{...o,ref:e}):(0,Uu.jsx)(udn,{...o,ref:e})})});Ekt.displayName=q$;var sdn=ea.forwardRef((t,e)=>{let r=RM(q$,t.__scopePopover),n=ea.useRef(null),o=dy(e,n),i=ea.useRef(!1);return ea.useEffect(()=>{let a=n.current;if(a)return SM(a)},[]),(0,Uu.jsx)(QAe,{as:T6,allowPinchZoom:!0,children:(0,Uu.jsx)(Pkt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:RS(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:RS(t.onPointerDownOutside,a=>{let s=a.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0,l=s.button===2||u;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:RS(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),udn=ea.forwardRef((t,e)=>{let r=RM(q$,t.__scopePopover),n=ea.useRef(!1),o=ea.useRef(!1);return(0,Uu.jsx)(Pkt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Pkt=ea.forwardRef((t,e)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:c,...d}=t,f=RM(q$,r),p=R6(r);return lM(),(0,Uu.jsx)(zAe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Uu.jsx)($Ae,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Uu.jsx)(skt,{"data-state":Mkt(f.open),role:"dialog",id:f.contentId,...p,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Tkt="PopoverClose",ldn=ea.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RM(Tkt,r);return(0,Uu.jsx)(ef.button,{type:"button",...n,ref:e,onClick:RS(t.onClick,()=>o.onOpenChange(!1))})});ldn.displayName=Tkt;var cdn="PopoverArrow",ddn=ea.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=R6(r);return(0,Uu.jsx)(ukt,{...o,...n,ref:e})});ddn.displayName=cdn;function Mkt(t){return t?"open":"closed"}var Akt=wkt;var Rkt=Ckt,Ikt=Okt,rRe=Ekt;var Dkt=Akt,jkt=Rkt;var nRe=I6.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>I6.createElement(Ikt,{container:n??activeDocument.body},I6.createElement(rRe,{ref:i,align:e,sideOffset:r,className:Te("z-popover w-72 rounded-md border border-border bg-primary p-4 text-normal shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o})));nRe.displayName=rRe.displayName;var oRe=B(Z()),Pie=oRe.createContext(void 0),U$=oRe.createContext(void 0);var z$=B(Z());function iRe(){let[t,e]=(0,z$.useState)(null),r=(0,z$.useContext)(U$);return(0,z$.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(dx.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(dx.ACTIVE_LEAF_CHANGE,n)}},[r]),t}var Nkt=require("obsidian");function Lkt(t,e=20){let r=app.metadataCache.getFileCache(t),n=[];if(r?.links)for(let o of r.links){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}if(r?.embeds&&n.length<e)for(let o of r.embeds){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}return[...new Set(n)]}function Fkt(t,e=20){let r=[],n=app.metadataCache.getBacklinksForFile(t);if(n?.data)for(let[o]of n.data){let i=app.vault.getAbstractFileByPath(o);if(i instanceof Nkt.TFile&&(r.push(i),r.length>=e))break}return r}var aRe=require("obsidian"),pdn=.4,hdn=20,kkt=.7,Tie=.3;async function mdn(t,e){let r=me().debug,n=await Wd.getDocsByPath(e,t);if(!n)return r&&console.log("No hits found for note:",t),[];let o=[];for(let i of n){if(!i?.document?.embedding){r&&console.log("No embedding found for note:",t);continue}o.push(i.document.embedding)}return o}function gdn(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);return t.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/e})}),r}function ydn(t,e){let r=new Map;for(let n of t){let o=r.get(n.document.path);o?n.score>o&&r.set(n.document.path,n.score):r.set(n.document.path,n.score)}return r.delete(e),r}async function bdn({db:t,filePath:e}){let r=me().debug,n=await mdn(e,t),o=gdn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await Wd.getDocsByEmbedding(t,o,{limit:hdn,similarity:pdn});return ydn(i,e)}function _dn(t){let e=new Map,n=Lkt(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=Fkt(t).map(a=>a.path);for(let a of i)e.has(a)?e.set(a,{links:!0,backlinks:!0}):e.set(a,{links:!1,backlinks:!0});return e}function vdn(t,e){let r=new Map,n=kkt+Tie;for(let[o,i]of t)r.set(o,i*kkt/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Tie:(i.links||i.backlinks)&&(a=Tie*.8),r.set(o,(r.get(o)??0)+a)}return r}async function Bkt({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof aRe.TFile))return[];let n=await bdn({db:t,filePath:e}),o=_dn(r),i=vdn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=Mie(n.get(l)??0),f=Mie(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 aRe.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 Mie(t){return t>.7?3:t>.55?2:1}var Rie=require("obsidian"),qe=B(Z());function wdn(t){let[e,r]=(0,qe.useState)([]),n=iRe();return(0,qe.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await Ki.getInstance().getDb(),a=await Bkt({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function Sdn(t,e){let[r,n]=(0,qe.useState)(!0);return(0,qe.useEffect)(()=>{if(!t)return;async function o(){let i=await Ki.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}var Aie=(0,qe.forwardRef)(({children:t,...e},r)=>qe.default.createElement("div",{ref:r,...e,className:"flex gap-2"},qe.default.createElement(Rm,{variant:"secondary",className:"text-muted font-normal whitespace-nowrap cursor-default"},t)));Aie.displayName="ExplainerBadge";function xdn(t,e){let r=t.split("/").slice(0,-1).join("/"),n=e.split("/").slice(0,-1).join("/");return r===n}function Cdn({score:t}){let e=Mie(t),r="\u{1F534} Low Similarity";return e===2&&(r="\u{1F7E0} Medium Similarity"),e===3&&(r="\u{1F7E2} High Similarity"),qe.default.createElement(Jr,null,qe.default.createElement(Gr,{asChild:!0},qe.default.createElement(Aie,null,r)),qe.default.createElement(Hr,{side:"right"},"Similarity Score: ",Math.round(t*100).toFixed(0),"%"))}function $kt({note:t}){return qe.default.createElement("div",{className:"flex gap-1"},t.metadata.similarityScore!=null&&qe.default.createElement(Cdn,{score:t.metadata.similarityScore}),t.metadata.hasOutgoingLinks&&qe.default.createElement(Aie,null,"Outgoing Links"),t.metadata.hasBacklinks&&qe.default.createElement(Aie,null,"Backlinks"))}function Odn({showPath:t=!1,note:e,onAddToChat:r,onNavigateToNote:n}){return qe.default.createElement("div",{className:"flex gap-2 p-2 justify-between rounded-md border border-border border-solid"},qe.default.createElement("div",{className:"flex flex-col gap-2 flex-1 overflow-hidden"},qe.default.createElement("a",{onClick:n,className:"text-sm text-normal font-bold text-ellipsis overflow-hidden whitespace-nowrap w-full"},e.document.title),t&&qe.default.createElement("span",{className:"text-xs text-faint text-ellipsis overflow-hidden whitespace-nowrap w-full"},e.document.path),qe.default.createElement("div",{className:"flex gap-1"},qe.default.createElement($kt,{note:e}))),qe.default.createElement("div",{className:"flex gap-2"},qe.default.createElement(Jr,null,qe.default.createElement(Gr,{asChild:!0},qe.default.createElement(Ge,{variant:"ghost2",size:"icon",onClick:r},qe.default.createElement(dg,{className:"size-4"}))),qe.default.createElement(Hr,null,"Add to Chat"))))}function Edn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return qe.default.createElement(Dkt,{key:t.document.path},qe.default.createElement(jkt,{asChild:!0},n),qe.default.createElement(nRe,{className:"flex flex-col gap-2 overflow-hidden w-fit min-w-72 max-w-96"},qe.default.createElement("span",{className:"text-sm text-normal"},t.document.title),qe.default.createElement("span",{className:"text-xs text-muted"},t.document.path),qe.default.createElement($kt,{note:t}),qe.default.createElement("div",{className:"flex gap-2"},qe.default.createElement("button",{onClick:e,className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Add to Chat ",qe.default.createElement(dg,{className:"size-4"})),qe.default.createElement("button",{onClick:r,className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Navigate to Note ",qe.default.createElement(uz,{className:"size-4"})))))}var Iie=(0,qe.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,qe.useState)(0),[i,a]=(0,qe.useState)(r),s=wdn(n),u=iRe(),l=Sdn(u?.path??"",n),c=p=>{let h=app.vault.getAbstractFileByPath(p);h instanceof Rie.TFile&&app.workspace.getLeaf(!1).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await Ki.getInstance().reindexFile(u),new Rie.Notice(`Reindexed ${u.name}`),o(n+1))};return qe.default.createElement("div",{className:Te("@container w-full border border-transparent border-b-border border-solid pb-2",t)},qe.default.createElement(vie,{open:i,onOpenChange:a},qe.default.createElement("div",{className:"flex justify-between items-center pl-1 pb-2"},qe.default.createElement("div",{className:"flex gap-2 items-center flex-1"},qe.default.createElement("span",{className:"font-semibold text-normal"},"Relevant Notes"),qe.default.createElement(Jr,null,qe.default.createElement(Gr,{asChild:!0},qe.default.createElement(vz,{className:"size-4 text-muted"})),qe.default.createElement(Hr,{side:"bottom",className:"w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&qe.default.createElement(Jr,null,qe.default.createElement(Gr,{asChild:!0},qe.default.createElement(xh,{className:"size-4 text-warning"})),qe.default.createElement(Hr,{side:"bottom"},"Note has not been indexed"))),qe.default.createElement("div",{className:"flex items-center"},qe.default.createElement(Jr,null,qe.default.createElement(Gr,{asChild:!0},qe.default.createElement(Ge,{variant:"ghost2",size:"icon",onClick:f},qe.default.createElement(Cz,{className:"size-4"}))),qe.default.createElement(Hr,{side:"bottom"},"Reindex Current Note")),s.length>0&&qe.default.createElement(wie,{asChild:!0},qe.default.createElement(Ge,{variant:"ghost2",size:"icon"},i?qe.default.createElement(QA,{className:"size-5"}):qe.default.createElement(Sl,{className:"size-5"}))))),s.length===0&&qe.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-12 overflow-y-hidden px-1"},qe.default.createElement("span",{className:"text-xs text-muted"},"No relevant notes found")),!i&&s.length>0&&qe.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-6 overflow-y-hidden px-1"},s.map(p=>qe.default.createElement(Edn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:()=>c(p.document.path)},qe.default.createElement(Rm,{variant:"outline",key:p.document.path,className:"text-xs max-w-40 text-muted hover:cursor-pointer hover:bg-interactive-hover"},qe.default.createElement("span",{className:"text-ellipsis overflow-hidden whitespace-nowrap"},p.document.title))))),qe.default.createElement(Sie,null,qe.default.createElement("div",{className:"px-1 py-2 max-h-screen overflow-y-auto flex flex-col gap-2 @2xl:grid @2xl:grid-cols-2 @4xl:grid-cols-3"},s.map(p=>qe.default.createElement(Odn,{showPath:!xdn(u?.path??"",p.document.path),note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:()=>c(p.document.path)}))))))});Iie.displayName="RelevantNotes";var Qf=B(Z());var D6=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("rounded-xl border border-border bg-primary text-normal shadow",t),...e}));D6.displayName="Card";var j6=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("flex flex-col space-y-1.5 p-6",t),...e}));j6.displayName="CardHeader";var sRe=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("font-semibold leading-none tracking-tight",t),...e}));sRe.displayName="CardTitle";var Pdn=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("text-sm text-muted",t),...e}));Pdn.displayName="CardDescription";var N6=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("p-6 pt-0",t),...e}));N6.displayName="CardContent";var Tdn=Qf.forwardRef(({className:t,...e},r)=>Qf.createElement("div",{ref:r,className:Te("flex items-center p-6 pt-0",t),...e}));Tdn.displayName="CardFooter";var hi=B(Z()),uRe={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>]]"]}},qkt={["llm_chain"]:["activeNote","quoteNote","fun"],["vault_qa"]:["qaVault","qaVault","quoteNote"],["copilot_plus"]:["copilotPlus","copilotPlus","copilotPlus"]};function Mdn(t="llm_chain"){let e=qkt[t]||qkt["llm_chain"],r={};return e.map(n=>(r[n]||(r[n]=[...uRe[n].prompts].sort(()=>Math.random()-.5)),{title:uRe[n].title,text:r[n].pop()||uRe[n].prompts[0]}))}var Ukt=({onClick:t})=>{let[e]=jy(),r=(0,hi.useMemo)(()=>Mdn(e),[e]),o=Fa().indexVaultToVectorStore;return hi.default.createElement("div",{className:"flex flex-col gap-4"},hi.default.createElement(D6,{className:"w-full bg-transparent"},hi.default.createElement(j6,{className:"px-2"},hi.default.createElement(sRe,null,"Suggested Prompts")),hi.default.createElement(N6,{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(Jr,null,hi.default.createElement(Gr,{asChild:!0},hi.default.createElement(Ge,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>t(i.text)},hi.default.createElement(dg,{className:"size-4"}))),hi.default.createElement(Hr,null,"Add to Chat")))))))),e==="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"),e==="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(xh,{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 bd=B(Z()),zkt=(0,bd.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l})=>{let[c,d]=(0,bd.useState)(""),f=Fa(),p=()=>{let m=document.querySelector("[data-testid='chat-messages']");m&&(m.scrollTop=m.scrollHeight)};if((0,bd.useEffect)(()=>{r||p()},[r]),(0,bd.useEffect)(()=>{let m;return r?m=setInterval(()=>{d(v=>v.length<6?v+".":"")},200):d(""),()=>clearInterval(m)},[r]),!t.filter(m=>m.isVisible).length&&!e)return bd.default.createElement("div",{className:"flex flex-col gap-2 overflow-y-auto w-full h-full"},f.showRelevantNotes&&bd.default.createElement(Iie,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),f.showSuggestedPrompts&&bd.default.createElement(Ukt,{onClick:l}));let h=()=>n?`${n} ${c}`:c;return bd.default.createElement("div",{className:"flex flex-col flex-1 h-full overflow-hidden"},f.showRelevantNotes&&bd.default.createElement(Iie,{className:"mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),bd.default.createElement("div",{"data-testid":"chat-messages",className:"flex flex-col items-start justify-start flex-1 overflow-y-auto w-full break-words text-[calc(var(--font-text-size)_-_2px)] box-border scroll-smooth mt-auto select-text"},t.map((m,v)=>m.isVisible&&bd.default.createElement(EAe,{key:v,message:m,app:o,isStreaming:!1,onRegenerate:()=>i(v),onEdit:g=>a(v,g),onDelete:()=>s(v)})),(e||r)&&bd.default.createElement(EAe,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{}})))});zkt.displayName="ChatMessages";var Hkt=zkt;var lRe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){console.error("Model request failed:",s);let u="Model request failed: ";s instanceof Error?(u+=s.message,s.cause&&(u+=` Cause: ${s.cause}`)):typeof s=="object"&&s!==null?u+=JSON.stringify(s):u+=String(s),r({sender:Iy,message:`Error: ${u}`,isVisible:!0,timestamp:ys(new Date)})}};var EO=class{constructor(){this.mentions=new Map,this.brevilabsClient=Sa.getInstance()}static getInstance(){return EO.instance||(EO.instance=new EO),EO.instance}extractAllUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o)}extractUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o).filter(n=>!_ke(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await lx.isImageUrl(s))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 $D=B(Z()),cRe=class{constructor(){this.chatHistory=[]}addMessage(e){this.chatHistory.push(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[]}};function Vkt(t){let[e,r]=(0,$D.useState)(t.getMessages());(0,$D.useEffect)(()=>{r(t.getMessages())},[t]);let n=(0,$D.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,$D.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var Wkt=cRe;var IS=require("obsidian"),Ln=B(Z()),Adn=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Fa(),s=(0,Ln.useContext)(U$),[u,l,c]=Vkt(t),[d]=i9(),[f]=jy(),[p,h]=(0,Ln.useState)(""),[m,v]=(0,Ln.useState)(""),[g,_]=(0,Ln.useState)(null),[S,x]=(0,Ln.useState)(!1),[O,T]=(0,Ln.useState)(cx.DEFAULT),[E,M]=(0,Ln.useState)(-1),[R,N]=(0,Ln.useState)([]),[j,k]=(0,Ln.useState)(!1),[F,L]=(0,Ln.useState)([]),q=EO.getInstance(),U=ly.getInstance(),G=(0,Ln.useRef)(null);(0,Ln.useEffect)(()=>{let ee=()=>{G.current&&G.current.focus()};return s?.addEventListener(dx.CHAT_IS_VISIBLE,ee),()=>{s?.removeEventListener(dx.CHAT_IS_VISIBLE,ee)}},[s]);let V=(0,Ln.useContext)(Pie),I=i.app||V,H=async(ee,ye)=>{let Ue=I.workspace.getActiveFile();return await U.processContextNotes(ee,ye,I.vault,R,j,Ue,f)},W=async({toolCalls:ee,urls:ye,contextNotes:Ue}={})=>{if(!m&&F.length===0)return;let ft=ys(new Date),Je=[];m&&Je.push({type:"text",text:m});for(let fr of F){let Ze=await fr.arrayBuffer(),$n=Buffer.from(Ze).toString("base64");Je.push({type:"image_url",image_url:{url:`data:${fr.type};base64,${$n}`}})}let cr=[...Ue||[]],Yr=I.workspace.getActiveFile();j&&Yr&&!cr.some(fr=>fr.path===Yr.path)&&cr.push(Yr);let dr={message:m||"Image message",originalMessage:m,sender:Ao,isVisible:!0,timestamp:ft,content:Je,context:{notes:cr,urls:ye||[]}};v(""),L([]),l(dr),x(!0),T(cx.DEFAULT);let qt=Yf.getInstance(I.vault),Uo=await qt.processCustomPrompt(m||"","",I.workspace.getActiveFile()),ra=f==="copilot_plus"?await q.processUrls(m||""):{urlContext:"",imageUrls:[]},Fo=await H(qt,o);Uo=Uo+ra.urlContext+Fo;let Ie=m;ee&&(Ie+=" "+ee.join(`
`));let Xe={message:Uo,originalMessage:Ie,sender:Ao,isVisible:!1,timestamp:ft,content:Je,context:{notes:cr,urls:f==="copilot_plus"?[...ye||[],...ra.imageUrls]:ye||[]}};l(Xe),m&&(n(m),M(-1)),await lRe(Xe,e,l,h,_,{debug:a.debug,updateLoadingMessage:T}),x(!1),T(cx.DEFAULT)},J=ee=>{let ye=i.userMessageHistory;return ee==="up"&&E<ye.length-1?(M(E+1),ye[ye.length-1-E-1]):ee==="down"&&E>-1?(M(E-1),E===0?"":ye[ye.length-1-E+1]):m},re=(0,Ln.useCallback)(async(ee=!1)=>{if(!I){console.error("App instance is not available.");return}let ye=u.filter(Je=>Je.isVisible);if(ye.length===0){new IS.Notice("No messages to save.");return}let Ue=ye[0].timestamp?.epoch||Date.now(),ft=ye.map(Je=>`**${Je.sender}**: ${Je.message}
[Timestamp: ${Je.timestamp?.display}]`).join(`
`);try{I.vault.getAbstractFileByPath(a.defaultSaveFolder)||await I.vault.createFolder(a.defaultSaveFolder);let{fileName:cr}=ys(new Date(Ue)),Yr=ye.find(Xe=>Xe.sender===Ao),dr=Yr?Yr.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",qt=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";qt=qt.replace("{$topic}",dr.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",cr.split("_")[0]).replace("{$time}",cr.split("_")[1]);let Uo=qt.replace(/[\\/:*?"<>|]/g,"_"),ra=`${a.defaultSaveFolder}/${Uo}.md`,Fo=`---
epoch: ${Ue}
modelKey: ${d}
tags:
- ${a.defaultConversationTag}
---
${ft}`,Ie=I.vault.getAbstractFileByPath(ra);if(Ie instanceof IS.TFile?(await I.vault.modify(Ie,Fo),new IS.Notice(`Chat updated in existing note: ${ra}`)):(await I.vault.create(ra,Fo),new IS.Notice(`Chat saved as new note: ${ra}`)),ee){let Xe=I.vault.getAbstractFileByPath(ra);Xe instanceof IS.TFile&&I.workspace.getLeaf().openFile(Xe)}}catch(Je){console.error("Error saving chat as note:",ia(Je)),new IS.Notice("Failed to save chat as note. Check console for details.")}},[I,u,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),Ae=(0,Ln.useCallback)(ee=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${ee}`),g.abort(ee),x(!1))},[g,a.debug]),Y=(0,Ln.useCallback)(async ee=>{let ye=ee-1;if(ye<0||u[ye].sender!==Ao){new IS.Notice("Cannot regenerate the first message or a user message.");return}let Ue=u[ye],ft=u.slice(0,ee);c(),ft.forEach(l),e.memoryManager.clearChatMemory();for(let Je=0;Je<ft.length;Je+=2){let cr=ft[Je],Yr=ft[Je+1];cr&&Yr&&await e.memoryManager.getMemory().saveContext({input:cr.message},{output:Yr.message})}x(!0);try{await e.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 IS.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}},[l,e,u,c,a.debug]),Q=(0,Ln.useCallback)(async(ee,ye)=>{let Ue=u[ee].message;if(Ue===ye)return;let ft=[...u];for(let Je=ee;Je<ft.length;Je++)ft[Je].originalMessage===Ue&&(ft[Je].message=ye,ft[Je].originalMessage=ye,ft[Je].context={notes:[],urls:[]});c(),ft.forEach(l),await QH(ft,e.memoryManager),ft[ee].sender===Ao&&ee<ft.length-1&&Y(ee+1)},[l,e.memoryManager,u,c,Y]),le=(ee,ye)=>()=>{let Ue=me().debug,ft=async Je=>{let Yr={message:await ye(Je.detail.selectedText,Je.detail.eventSubtype),sender:Ao,isVisible:Ue,timestamp:ys(new Date)};Ue&&l(Yr),x(!0),await lRe(Yr,e,l,h,_,{debug:Ue,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(ee,ft),()=>{s?.removeEventListener(ee,ft)}},Re=Yf.getInstance(I.vault);(0,Ln.useEffect)(le(te.APPLY_CUSTOM_PROMPT,async(ee,ye)=>ye?await Re.processCustomPrompt(ye,ee,I.workspace.getActiveFile()??void 0):ee),[]),(0,Ln.useEffect)(le(te.APPLY_ADHOC_PROMPT,async(ee,ye)=>ye?await Re.processCustomPrompt(ye,ee,I.workspace.getActiveFile()):ee),[]),(0,Ln.useEffect)(()=>{r&&r(re)},[r,re]);let gt=(0,Ln.useCallback)(async ee=>{let ye=[...u];ye.splice(ee,1),c(),ye.forEach(l),await QH(ye,e.memoryManager)},[l,e.memoryManager,u,c]),Se=(0,Ln.useCallback)(ee=>{v(ye=>`${ye} ${ee} `)},[]),ae=(0,Ln.useCallback)(async()=>{Ae("new-chat"),a.autosaveChat&&u.length>0&&await re(!0),c(),e.memoryManager.clearChatMemory(),h(""),N([]),k(!1)},[Ae,a.autosaveChat,u.length,c,e.memoryManager,re]);return Ln.default.createElement("div",{className:"chat-container"},Ln.default.createElement(Hkt,{chatHistory:u,currentAiMessage:p,loading:S,loadingMessage:O,app:I,onRegenerate:Y,onEdit:Q,onDelete:gt,onInsertToChat:Se,onReplaceChat:v}),Ln.default.createElement("div",{className:"bottom-container"},Ln.default.createElement(ALt,{onNewChat:ae,onSaveAsNote:()=>re(!0)}),Ln.default.createElement(_Ft,{ref:G,inputMessage:m,setInputMessage:v,handleSendMessage:W,isGenerating:S,onStopGenerating:()=>Ae("user-stopped"),app:I,navigateHistory:J,contextNotes:R,setContextNotes:N,includeActiveNote:j,setIncludeActiveNote:k,mention:q,selectedImages:F,onAddImage:ee=>L(ye=>[...ye,...ee]),setSelectedImages:L})))},Jkt=Adn;var Gkt=require("obsidian"),IM=B(Z()),Kkt=B(lg()),DM=class extends Gkt.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 _l}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){let r=(0,Kkt.createRoot)(this.containerEl.children[1]),n=i=>{this.handleSaveAsNote=i},o=i=>{this.plugin.updateUserMessageHistory(i)};r.render(IM.createElement(Pie.Provider,{value:this.app},IM.createElement(U$.Provider,{value:this.eventTarget},IM.createElement(IM.StrictMode,null,IM.createElement(lie,{delayDuration:0},IM.createElement(Jkt,{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 Ykt=require("obsidian"),Die=class extends Ykt.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=ys(new Date(i.epoch)):o=ys(new Date(r.stat.ctime)),`${n} - ${o.display}`}onChooseItem(r,n){this.onChooseFile(r)}};function Xkt(t,e,r){Tke.filter(n=>SD(n)).forEach(n=>{t.addItem(o=>{o.setTitle(`Copilot: ${Dy[n]}`).onClick(async i=>{r.app.commands.executeCommandById(`copilot:${n}`)})})})}var Q6=require("obsidian"),czt=B(Z()),dzt=B(lg());var Zkt=require("obsidian"),qD=B(Z()),Qkt=B(lg());function Rdn({content:t,onConfirm:e,onCancel:r}){return qD.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"20px"}},qD.default.createElement("div",null,t),qD.default.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"}},qD.default.createElement("button",{onClick:r},"Cancel"),qD.default.createElement("button",{style:{backgroundColor:"var(--interactive-accent)",color:"var(--text-on-accent)",cursor:"pointer"},onClick:e},"Continue")))}var H$=class extends Zkt.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,Qkt.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(qD.default.createElement(Rdn,{content:this.content,onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var jie=class extends H${constructor(e,r){super(e,r,"Resetting settings will clear all settings and restore the default values. You will lose any custom settings you have made including the API keys. Are you sure you want to continue?","Reset Settings")}};var L6=B(Z());var eBt=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>L6.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Te("flex flex-row items-center","h-8","px-2 py-1","gap-1.5","cursor-pointer","overflow-hidden","whitespace-nowrap","text-sm","border border-border border-solid","rounded-t-md rounded-b-[2px]","bg-primary","transition-all duration-300 ease-in-out","hover:border-interactive-accent hover:border-b-0",e&&["!bg-interactive-accent","text-on-accent","!px-3","!max-w-full","border-b-0","transition-all duration-300 ease-in-out","delay-200"],"lg:max-w-32","md:max-w-32")},L6.default.createElement("div",{className:Te("flex items-center justify-center","w-4 h-4","transition-transform duration-200 ease-in-out",e?"opacity-100 max-w-[16px] translate-x-0":"opacity-0 max-w-0 -translate-x-4")},t.icon),L6.default.createElement("span",{className:Te("text-sm","font-medium","transition-all duration-200 ease-in-out","overflow-hidden whitespace-nowrap","opacity-100 max-w-[100px] translate-x-0")},t.label)),tBt=({id:t,children:e,isSelected:r})=>r?L6.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Te("pt-4","transition-all duration-200 ease-in-out",r?"opacity-100 translate-y-0":"opacity-0 translate-y-2")},e):null;var Yp=B(Z()),rBt=(0,Yp.createContext)(void 0),nBt=({children:t})=>{let[e,r]=(0,Yp.useState)("basic"),[n,o]=(0,Yp.useState)(null),i=(0,Yp.useRef)(!1);return(0,Yp.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),Yp.default.createElement(rBt.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},DS=()=>{let t=(0,Yp.useContext)(rBt);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};var mn=B(Z());var VD=B(Z());var Fi=B(Z());var Xp=B(Z());function jM({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Xp.useState)(!1),s=(0,Xp.useRef)(null),u=(0,Xp.useRef)(!0);return(0,Xp.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await Qo(t)}catch(c){Mo("Failed to decrypt value:"+ia(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Xp.default.createElement("div",{className:Te("relative",o)},Xp.default.createElement(Ii,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Te("![padding-right:1.75rem] w-full")}),Xp.default.createElement("div",{onClick:()=>!n&&a(!i),className:Te("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?Xp.default.createElement(gz,{className:Te("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")}):Xp.default.createElement(xx,{className:Te("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")})))}var Nc=B(Z());var mi=B(Z(),1);function jS(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var iBt=B(Z(),1);function oBt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function dRe(...t){return e=>{let r=!1,n=t.map(o=>{let i=oBt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():oBt(t[o],null)}}}}function PO(...t){return iBt.useCallback(dRe(...t),t)}var Ra=B(Z(),1);var aBt=B(Z(),1),sBt=B(_s(),1);var jc=B(Z(),1);var V$=B(dt(),1),F6=jc.forwardRef((t,e)=>{let{children:r,...n}=t,o=jc.Children.toArray(r),i=o.find(Ddn);if(i){let a=i.props.children,s=o.map(u=>u===i?jc.Children.count(a)>1?jc.Children.only(null):jc.isValidElement(a)?a.props.children:null:u);return(0,V$.jsx)(fRe,{...n,ref:e,children:jc.isValidElement(a)?jc.cloneElement(a,void 0,s):null})}return(0,V$.jsx)(fRe,{...n,ref:e,children:r})});F6.displayName="Slot";var fRe=jc.forwardRef((t,e)=>{let{children:r,...n}=t;if(jc.isValidElement(r)){let o=Ndn(r);return jc.cloneElement(r,{...jdn(n,r.props),ref:e?dRe(e,o):o})}return jc.Children.count(r)>1?jc.Children.only(null):null});fRe.displayName="SlotClone";var Idn=({children:t})=>(0,V$.jsx)(V$.Fragment,{children:t});function Ddn(t){return jc.isValidElement(t)&&t.type===Idn}function jdn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Ndn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var uBt=B(dt(),1),Ldn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Zp=Ldn.reduce((t,e)=>{let r=aBt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?F6:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,uBt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function lBt(t,e){t&&sBt.flushSync(()=>t.dispatchEvent(e))}var hRe=B(dt(),1),Fdn="DismissableLayer",pRe="dismissableLayer.update",kdn="dismissableLayer.pointerDownOutside",Bdn="dismissableLayer.focusOutside",cBt,fBt=Ra.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mRe=Ra.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ra.useContext(fBt),[c,d]=Ra.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ra.useState({}),h=PO(e,E=>d(E)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(v),_=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,O=Udn(E=>{let M=E.target,R=[...l.branches].some(N=>N.contains(M));!x||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=zdn(E=>{let M=E.target;[...l.branches].some(N=>N.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return OS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ra.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(cBt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),dBt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=cBt)}},[c,f,r,l]),Ra.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),dBt())},[c,l]),Ra.useEffect(()=>{let E=()=>p({});return document.addEventListener(pRe,E),()=>document.removeEventListener(pRe,E)},[]),(0,hRe.jsx)(Zp.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:jS(t.onFocusCapture,T.onFocusCapture),onBlurCapture:jS(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:jS(t.onPointerDownCapture,O.onPointerDownCapture)})});mRe.displayName=Fdn;var $dn="DismissableLayerBranch",qdn=Ra.forwardRef((t,e)=>{let r=Ra.useContext(fBt),n=Ra.useRef(null),o=PO(e,n);return Ra.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,hRe.jsx)(Zp.div,{...t,ref:o})});qdn.displayName=$dn;function Udn(t,e=globalThis?.document){let r=Gt(t),n=Ra.useRef(!1),o=Ra.useRef(()=>{});return Ra.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){pBt(kdn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function zdn(t,e=globalThis?.document){let r=Gt(t),n=Ra.useRef(!1);return Ra.useEffect(()=>{let o=i=>{i.target&&!n.current&&pBt(Bdn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function dBt(){let t=new CustomEvent(pRe);document.dispatchEvent(t)}function pBt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?lBt(o,i):o.dispatchEvent(i)}var Dm=B(Z(),1);var bBt=B(dt(),1),gRe="focusScope.autoFocusOnMount",yRe="focusScope.autoFocusOnUnmount",hBt={bubbles:!1,cancelable:!0},Hdn="FocusScope",bRe=Dm.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Dm.useState(null),l=Gt(o),c=Gt(i),d=Dm.useRef(null),f=PO(e,m=>u(m)),p=Dm.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Dm.useEffect(()=>{if(n){let _=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:NM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||NM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&NM(s)};var m=_,v=S,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Dm.useEffect(()=>{if(s){gBt.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(gRe,hBt);s.addEventListener(gRe,l),s.dispatchEvent(g),g.defaultPrevented||(Vdn(Ydn(_Bt(s)),{select:!0}),document.activeElement===m&&NM(s))}return()=>{s.removeEventListener(gRe,l),setTimeout(()=>{let g=new CustomEvent(yRe,hBt);s.addEventListener(yRe,c),s.dispatchEvent(g),g.defaultPrevented||NM(m??document.body,{select:!0}),s.removeEventListener(yRe,c),gBt.remove(p)},0)}}},[s,l,c,p]);let h=Dm.useCallback(m=>{if(!r&&!n||p.paused)return;let v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(v&&g){let _=m.currentTarget,[S,x]=Wdn(_);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&NM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&NM(x,{select:!0})):g===_&&m.preventDefault()}},[r,n,p.paused]);return(0,bBt.jsx)(Zp.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});bRe.displayName=Hdn;function Vdn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(NM(n,{select:e}),document.activeElement!==r)return}function Wdn(t){let e=_Bt(t),r=mBt(e,t),n=mBt(e.reverse(),t);return[r,n]}function _Bt(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function mBt(t,e){for(let r of t)if(!Jdn(r,{upTo:e}))return r}function Jdn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Gdn(t){return t instanceof HTMLInputElement&&"select"in t}function NM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Gdn(t)&&e&&t.select()}}var gBt=Kdn();function Kdn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=yBt(t,e),t.unshift(e)},remove(e){t=yBt(t,e),t[0]?.resume()}}}function yBt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Ydn(t){return t.filter(e=>e.tagName!=="A")}var Nie=B(Z(),1),vBt=B(_s(),1);var wBt=B(dt(),1),Xdn="Portal",_Re=Nie.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Nie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?vBt.default.createPortal((0,wBt.jsx)(Zp.div,{...n,ref:e}),a):null});_Re.displayName=Xdn;var kie=B(Z());var _d=B(Z());var Lie=RD();var vRe=function(){},k6=_d.forwardRef(function(t,e){var r=_d.useRef(null),n=_d.useState({onScrollCapture:vRe,onWheelCapture:vRe,onTouchMoveCapture:vRe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,h=t.inert,m=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,S=xM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=AD([r,e]),T=Lo(Lo({},S),o);return _d.createElement(_d.Fragment,null,c&&_d.createElement(x,{sideCar:Lie,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?_d.cloneElement(_d.Children.only(s),Lo(Lo({},T),{ref:O})):_d.createElement(g,Lo({},T,{className:u,ref:O}),s))});k6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};k6.classNames={fullWidth:sy,zeroRight:ay};var Li=B(Z());var wRe=!1;if(typeof window<"u")try{B6=Object.defineProperty({},"passive",{get:function(){return wRe=!0,!0}}),window.addEventListener("test",B6,B6),window.removeEventListener("test",B6,B6)}catch{wRe=!1}var B6,UD=wRe?{passive:!1}:!1;var Zdn=function(t){return t.tagName==="TEXTAREA"},SBt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Zdn(t)&&r[e]==="visible")},Qdn=function(t){return SBt(t,"overflowY")},efn=function(t){return SBt(t,"overflowX")},SRe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=xBt(t,n);if(o){var i=CBt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},tfn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},rfn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},xBt=function(t,e){return t==="v"?Qdn(e):efn(e)},CBt=function(t,e){return t==="v"?tfn(e):rfn(e)},nfn=function(t,e){return t==="h"&&e==="rtl"?-1:1},OBt=function(t,e,r,n,o){var i=nfn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=CBt(t,s),h=p[0],m=p[1],v=p[2],g=m-v-i*h;(h||g)&&xBt(t,s)&&(d+=g,f+=h),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Fie=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},EBt=function(t){return[t.deltaX,t.deltaY]},PBt=function(t){return t&&"current"in t?t.current:t},ofn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ifn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},afn=0,W$=[];function TBt(t){var e=Li.useRef([]),r=Li.useRef([0,0]),n=Li.useRef(),o=Li.useState(afn++)[0],i=Li.useState(CO)[0],a=Li.useRef(t);Li.useEffect(function(){a.current=t},[t]),Li.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=A$([t.lockRef.current],(t.shards||[]).map(PBt),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Li.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var g=Fie(m),_=r.current,S="deltaX"in m?m.deltaX:_[0]-g[0],x="deltaY"in m?m.deltaY:_[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=SRe(E,T);if(!M)return!0;if(M?O=E:(O=E==="v"?"h":"v",M=SRe(E,T)),!M)return!1;if(!n.current&&"changedTouches"in m&&(S||x)&&(n.current=O),!O)return!0;var R=n.current||O;return OBt(R,v,m,R==="h"?S:x,!0)},[]),u=Li.useCallback(function(m){var v=m;if(!(!W$.length||W$[W$.length-1]!==i)){var g="deltaY"in v?EBt(v):Fie(v),_=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&ofn(O.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var S=(a.current.shards||[]).map(PBt).filter(Boolean).filter(function(O){return O.contains(v.target)}),x=S.length>0?s(v,S[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=Li.useCallback(function(m,v,g,_){var S={name:m,delta:v,target:g,should:_,shadowParent:sfn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=Li.useCallback(function(m){r.current=Fie(m),n.current=void 0},[]),d=Li.useCallback(function(m){l(m.type,EBt(m),m.target,s(m,t.lockRef.current))},[]),f=Li.useCallback(function(m){l(m.type,Fie(m),m.target,s(m,t.lockRef.current))},[]);Li.useEffect(function(){return W$.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,UD),document.addEventListener("touchmove",u,UD),document.addEventListener("touchstart",c,UD),function(){W$=W$.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,UD),document.removeEventListener("touchmove",u,UD),document.removeEventListener("touchstart",c,UD)}},[]);var p=t.removeScrollBar,h=t.inert;return Li.createElement(Li.Fragment,null,h?Li.createElement(i,{styles:ifn(o)}):null,p?Li.createElement(DD,{gapMode:t.gapMode}):null)}function sfn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var MBt=ID(Lie,TBt);var ABt=kie.forwardRef(function(t,e){return kie.createElement(k6,Lo({},t,{ref:e,sideCar:MBt}))});ABt.classNames=k6.classNames;var $6=ABt;var Xo=B(dt(),1),xRe="Dialog",[RBt,i5o]=No(xRe),[ufn,fy]=RBt(xRe),IBt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=mi.useRef(null),u=mi.useRef(null),[l=!1,c]=ll({prop:n,defaultProp:o,onChange:i});return(0,Xo.jsx)(ufn,{scope:e,triggerRef:s,contentRef:u,contentId:Ga(),titleId:Ga(),descriptionId:Ga(),open:l,onOpenChange:c,onOpenToggle:mi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};IBt.displayName=xRe;var DBt="DialogTrigger",jBt=mi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fy(DBt,r),i=PO(e,o.triggerRef);return(0,Xo.jsx)(Zp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ERe(o.open),...n,ref:i,onClick:jS(t.onClick,o.onOpenToggle)})});jBt.displayName=DBt;var CRe="DialogPortal",[lfn,NBt]=RBt(CRe,{forceMount:void 0}),LBt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=fy(CRe,e);return(0,Xo.jsx)(lfn,{scope:e,forceMount:r,children:mi.Children.map(n,a=>(0,Xo.jsx)($u,{present:r||i.open,children:(0,Xo.jsx)(_Re,{asChild:!0,container:o,children:a})}))})};LBt.displayName=CRe;var Bie="DialogOverlay",FBt=mi.forwardRef((t,e)=>{let r=NBt(Bie,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=fy(Bie,t.__scopeDialog);return i.modal?(0,Xo.jsx)($u,{present:n||i.open,children:(0,Xo.jsx)(cfn,{...o,ref:e})}):null});FBt.displayName=Bie;var cfn=mi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fy(Bie,r);return(0,Xo.jsx)($6,{as:F6,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Xo.jsx)(Zp.div,{"data-state":ERe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),zD="DialogContent",kBt=mi.forwardRef((t,e)=>{let r=NBt(zD,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=fy(zD,t.__scopeDialog);return(0,Xo.jsx)($u,{present:n||i.open,children:i.modal?(0,Xo.jsx)(dfn,{...o,ref:e}):(0,Xo.jsx)(ffn,{...o,ref:e})})});kBt.displayName=zD;var dfn=mi.forwardRef((t,e)=>{let r=fy(zD,t.__scopeDialog),n=mi.useRef(null),o=PO(e,r.contentRef,n);return mi.useEffect(()=>{let i=n.current;if(i)return SM(i)},[]),(0,Xo.jsx)(BBt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:jS(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:jS(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:jS(t.onFocusOutside,i=>i.preventDefault())})}),ffn=mi.forwardRef((t,e)=>{let r=fy(zD,t.__scopeDialog),n=mi.useRef(!1),o=mi.useRef(!1);return(0,Xo.jsx)(BBt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),BBt=mi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=fy(zD,r),u=mi.useRef(null),l=PO(e,u);return lM(),(0,Xo.jsxs)(Xo.Fragment,{children:[(0,Xo.jsx)(bRe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Xo.jsx)(mRe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ERe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Xo.jsxs)(Xo.Fragment,{children:[(0,Xo.jsx)(pfn,{titleId:s.titleId}),(0,Xo.jsx)(mfn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),ORe="DialogTitle",$Bt=mi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fy(ORe,r);return(0,Xo.jsx)(Zp.h2,{id:o.titleId,...n,ref:e})});$Bt.displayName=ORe;var qBt="DialogDescription",UBt=mi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fy(qBt,r);return(0,Xo.jsx)(Zp.p,{id:o.descriptionId,...n,ref:e})});UBt.displayName=qBt;var zBt="DialogClose",HBt=mi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fy(zBt,r);return(0,Xo.jsx)(Zp.button,{type:"button",...n,ref:e,onClick:jS(t.onClick,()=>o.onOpenChange(!1))})});HBt.displayName=zBt;function ERe(t){return t?"open":"closed"}var VBt="DialogTitleWarning",[a5o,WBt]=T1t(VBt,{contentName:zD,titleName:ORe,docsSlug:"dialog"}),pfn=({titleId:t})=>{let e=WBt(VBt),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return mi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},hfn="DialogDescriptionWarning",mfn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WBt(hfn).contentName}}.`;return mi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},JBt=IBt,GBt=jBt,KBt=LBt,PRe=FBt,TRe=kBt,MRe=$Bt,ARe=UBt,YBt=HBt;var LM=JBt,XBt=GBt,yfn=KBt;var ZBt=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement(PRe,{ref:r,className:Te("fixed inset-0 z-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","bg-overlay/50",t),...e}));ZBt.displayName=PRe.displayName;var TO=Nc.forwardRef(({className:t,children:e,container:r,...n},o)=>Nc.createElement(yfn,{container:r},Nc.createElement(ZBt,null),Nc.createElement(TRe,{ref:o,className:Te("fixed left-[50%] top-[50%] z-modal grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n},e,Nc.createElement(YBt,{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"},Nc.createElement(Ch,{className:"h-4 w-4"}),Nc.createElement("span",{className:"sr-only"},"Close")))));TO.displayName=TRe.displayName;var MO=({className:t,...e})=>Nc.createElement("div",{className:Te("flex flex-col space-y-0.5 text-center sm:text-left",t),...e});MO.displayName="DialogHeader";var bfn=({className:t,...e})=>Nc.createElement("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});bfn.displayName="DialogFooter";var AO=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement(MRe,{ref:r,className:Te("text-lg font-semibold leading-none tracking-tight mt-0",t),...e}));AO.displayName=MRe.displayName;var RO=Nc.forwardRef(({className:t,...e},r)=>Nc.createElement(ARe,{ref:r,className:Te("text-sm text-muted",t),...e}));RO.displayName=ARe.displayName;var kM=B(Z());var HD=B(Z());var ii=B(Z(),1);function J$(t,[e,r]){return Math.min(r,Math.max(e,t))}function qo(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var $ie=B(Z(),1);function G$(t){let e=$ie.useRef({value:t,previous:t});return $ie.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var QBt=B(Z(),1),e$t=B(_s(),1);var t$t=B(dt(),1),_fn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fn=_fn.reduce((t,e)=>{let r=QBt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?qy:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,t$t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function r$t(t,e){t&&e$t.flushSync(()=>t.dispatchEvent(e))}var FM=B(Z(),1);var IO=B(Z(),1),n$t=B(dt(),1);function o$t(t,e=[]){let r=[];function n(i,a){let s=IO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,v=IO.useMemo(()=>h,Object.values(h));return(0,n$t.jsx)(m.Provider,{value:v,children:p})}function c(d,f){let p=f?.[t][u]||s,h=IO.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=>IO.createContext(a));return function(s){let u=s?.[t]||i;return IO.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,vfn(o,...e)]}function vfn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return IO.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var qie=B(dt(),1);function Uie(t){let e=t+"CollectionProvider",[r,n]=o$t(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,v=FM.default.useRef(null),g=FM.default.useRef(new Map).current;return(0,qie.jsx)(o,{scope:h,itemMap:g,collectionRef:v,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=FM.default.forwardRef((p,h)=>{let{scope:m,children:v}=p,g=i(s,m),_=Vo(h,g.collectionRef);return(0,qie.jsx)(qy,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=FM.default.forwardRef((p,h)=>{let{scope:m,children:v,...g}=p,_=FM.default.useRef(null),S=Vo(h,_),x=i(l,m);return FM.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,qie.jsx)(qy,{[c]:"",ref:S,children:v})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return FM.default.useCallback(()=>{let v=h.collectionRef.current;if(!v)return[];let g=Array.from(v.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 dl=B(dt(),1),i$t=["PageUp","PageDown"],a$t=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],s$t={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},K$="Slider",[RRe,wfn,Sfn]=Uie(K$),[u$t,A5o]=No(K$,[Sfn]),[xfn,zie]=u$t(K$),l$t=ii.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:h,...m}=t,v=ii.useRef(new Set),g=ii.useRef(0),S=a==="horizontal"?Cfn:Ofn,[x=[],O]=ll({prop:c,defaultProp:l,onChange:j=>{[...v.current][g.current]?.focus(),d(j)}}),T=ii.useRef(x);function E(j){let k=Afn(x,j);N(j,k)}function M(j){N(j,g.current)}function R(){let j=T.current[g.current];x[g.current]!==j&&f(x)}function N(j,k,{commit:F}={commit:!1}){let L=jfn(i),q=Nfn(Math.round((j-n)/i)*i+n,L),U=J$(q,[n,o]);O((G=[])=>{let V=Tfn(G,U,k);if(Dfn(V,u*i)){g.current=V.indexOf(U);let I=String(V)!==String(G);return I&&F&&f(V),I?V:G}else return G})}return(0,dl.jsx)(xfn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:v.current,values:x,orientation:a,form:h,children:(0,dl.jsx)(RRe.Provider,{scope:t.__scopeSlider,children:(0,dl.jsx)(RRe.Slot,{scope:t.__scopeSlider,children:(0,dl.jsx)(S,{"aria-disabled":s,"data-disabled":s?"":void 0,...m,ref:e,onPointerDown:qo(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:R,onHomeKeyDown:()=>!s&&N(n,0,{commit:!0}),onEndKeyDown:()=>!s&&N(o,x.length-1,{commit:!0}),onStepKeyDown:({event:j,direction:k})=>{if(!s){let q=i$t.includes(j.key)||j.shiftKey&&a$t.includes(j.key)?10:1,U=g.current,G=x[U],V=i*q*k;N(G+V,U,{commit:!0})}}})})})})});l$t.displayName=K$;var[c$t,d$t]=u$t(K$,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Cfn=ii.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=ii.useState(null),p=Vo(e,S=>f(S)),h=ii.useRef(),m=uM(o),v=m==="ltr",g=v&&!i||!v&&i;function _(S){let x=h.current||d.getBoundingClientRect(),O=[0,x.width],E=jRe(O,g?[r,n]:[n,r]);return h.current=x,E(S-x.left)}return(0,dl.jsx)(c$t,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,dl.jsx)(f$t,{dir:m,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,["--radix-slider-thumb-transform"]:"translateX(-50%)"},onSlideStart:S=>{let x=_(S.clientX);a?.(x)},onSlideMove:S=>{let x=_(S.clientX);s?.(x)},onSlideEnd:()=>{h.current=void 0,u?.()},onStepKeyDown:S=>{let O=s$t[g?"from-left":"from-right"].includes(S.key);l?.({event:S,direction:O?-1:1})}})})}),Ofn=ii.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=ii.useRef(null),d=Vo(e,c),f=ii.useRef(),p=!o;function h(m){let v=f.current||c.current.getBoundingClientRect(),g=[0,v.height],S=jRe(g,p?[n,r]:[r,n]);return f.current=v,S(m-v.top)}return(0,dl.jsx)(c$t,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,dl.jsx)(f$t,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,["--radix-slider-thumb-transform"]:"translateY(50%)"},onSlideStart:m=>{let v=h(m.clientY);i?.(v)},onSlideMove:m=>{let v=h(m.clientY);a?.(v)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:m=>{let g=s$t[p?"from-bottom":"from-top"].includes(m.key);u?.({event:m,direction:g?-1:1})}})})}),f$t=ii.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=zie(K$,r);return(0,dl.jsx)(Fn.span,{...l,ref:e,onKeyDown:qo(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):i$t.concat(a$t).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:qo(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:qo(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:qo(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),p$t="SliderTrack",h$t=ii.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=zie(p$t,r);return(0,dl.jsx)(Fn.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});h$t.displayName=p$t;var IRe="SliderRange",m$t=ii.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=zie(IRe,r),i=d$t(IRe,r),a=ii.useRef(null),s=Vo(e,a),u=o.values.length,l=o.values.map(f=>y$t(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,dl.jsx)(Fn.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});m$t.displayName=IRe;var DRe="SliderThumb",g$t=ii.forwardRef((t,e)=>{let r=wfn(t.__scopeSlider),[n,o]=ii.useState(null),i=Vo(e,s=>o(s)),a=ii.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,dl.jsx)(Efn,{...t,ref:i,index:a})}),Efn=ii.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=zie(DRe,r),s=d$t(DRe,r),[u,l]=ii.useState(null),c=Vo(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=Tm(u),p=a.values[n],h=p===void 0?0:y$t(p,a.min,a.max),m=Mfn(n,a.values.length),v=f?.[s.size],g=v?Rfn(v,h,s.direction):0;return ii.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,dl.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${h}% + ${g}px)`},children:[(0,dl.jsx)(RRe.ItemSlot,{scope:t.__scopeSlider,children:(0,dl.jsx)(Fn.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:qo(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,dl.jsx)(Pfn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});g$t.displayName=DRe;var Pfn=t=>{let{value:e,...r}=t,n=ii.useRef(null),o=G$(e);return ii.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==e&&u){let l=new Event("input",{bubbles:!0});u.call(i,e),i.dispatchEvent(l)}},[o,e]),(0,dl.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function Tfn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function y$t(t,e,r){let i=100/(r-e)*(t-e);return J$(i,[0,100])}function Mfn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Afn(t,e){if(t.length===1)return 0;let r=t.map(o=>Math.abs(o-e)),n=Math.min(...r);return r.indexOf(n)}function Rfn(t,e,r){let n=t/2,i=jRe([0,50],[0,n]);return(n-i(e)*r)*r}function Ifn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function Dfn(t,e){if(e>0){let r=Ifn(t);return Math.min(...r)>=e}return!0}function jRe(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function jfn(t){return(String(t).split(".")[1]||"").length}function Nfn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var NRe=l$t,b$t=h$t,_$t=m$t,v$t=g$t;var LRe=HD.forwardRef(({className:t,...e},r)=>HD.createElement(NRe,{ref:r,className:Te("relative flex w-full touch-none select-none items-center",t),...e},HD.createElement(b$t,{className:"relative h-1.5 w-full grow overflow-hidden border border-solid border-interactive-accent/30 rounded-full bg-interactive-accent/20"},HD.createElement(_$t,{className:"absolute h-full bg-interactive-accent"})),HD.createElement(v$t,{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"})));LRe.displayName=NRe.displayName;function w$t({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,kM.useState)(t);return(0,kM.useEffect)(()=>{u(t)},[t]),kM.default.createElement("div",{className:Te("flex items-center gap-4",a)},kM.default.createElement(LRe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"flex-1"}),kM.default.createElement("div",{className:"min-w-[40px] text-sm text-right"},s))}function yo(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=DS(),a="onChange"in t?t.onChange:void 0,s=(0,Fi.useMemo)(()=>{if(a)return wke(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Fi.default.createElement(Ii,{type:t.type,defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"password":return Fi.default.createElement(jM,{value:t.value!==void 0?String(t.value):void 0,onChange:l=>{s?.(l)},placeholder:t.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"textarea":return Fi.default.createElement(e6,{defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,rows:t.rows||3,disabled:o,className:"w-full sm:w-[300px] min-h-[80px]"});case"switch":return Fi.default.createElement(MS,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Fi.default.createElement("div",{className:"relative w-full sm:w-[200px] group"},Fi.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Te("w-full appearance-none","flex h-9 rounded-md border border-solid border-border bg-dropdown px-3 py-1 pr-8","text-sm !shadow transition-colors","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-interactive-hover hover:text-normal")},t.placeholder&&Fi.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Fi.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Fi.default.createElement("div",{className:Te("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2","transition-colors group-hover:[&>svg]:text-on-accent",o&&"opacity-50")},Fi.default.createElement(Sl,{className:"h-4 w-4"})));case"slider":return Fi.default.createElement(w$t,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"w-full sm:w-[300px]"});case"dialog":return Fi.default.createElement(LM,null,Fi.default.createElement(XBt,{asChild:!0},t.trigger),Fi.default.createElement(TO,{container:i},(t.dialogTitle||t.dialogDescription)&&Fi.default.createElement(MO,null,t.dialogTitle&&Fi.default.createElement(AO,null,t.dialogTitle),t.dialogDescription&&Fi.default.createElement(RO,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Fi.default.createElement("div",{className:Te("flex flex-col sm:flex-row items-start sm:items-center justify-between py-4 gap-4","w-full",n)},Fi.default.createElement("div",{className:"space-y-1.5 w-full sm:w-[300px]"},Fi.default.createElement("div",{className:"text-sm font-medium leading-none"},e),r&&Fi.default.createElement("div",{className:"text-xs text-muted"},r)),Fi.default.createElement("div",{className:"flex-1 w-full sm:flex sm:justify-end"},u()))}var Ffn=()=>{let t=Fa();return VD.default.createElement("div",{className:"space-y-4"},VD.default.createElement("section",null,VD.default.createElement(yo,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>Ft("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),VD.default.createElement("div",{className:"space-y-4"},VD.default.createElement(yo,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{Ft("enableEncryption",e)}}),VD.default.createElement(yo,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{Ft("debug",e)}}))))},S$t=Ffn;var Y$=class extends H${constructor(e,r){super(e,r,"Changing this setting means you have to rebuild the index for your entire vault, do you wish to proceed?","Rebuild Index")}};var X$=require("obsidian"),ve=B(Z());var Hie=require("obsidian"),Ka=B(Z()),kfn=({open:t,onOpenChange:e,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 v=pE[m];n(v,"")}),e(h)},c=h=>{let m=pE[h];return r[m]??""},d=Mle().map(h=>{let m=h,v=c(m);return{provider:m,apiKey:v,isVerified:!!v&&!s.has(m)}}),f=(h,m)=>{c(h)!==m&&(n(pE[h],m),u(g=>new Set(g).add(h)))},p=async(h,m)=>{a(v=>new Set(v).add(h));try{r.debug&&console.log(`Verifying ${h} API key:`,m);let v=DA(h).testModel;if(!v){new Hie.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let g={name:v,provider:h,apiKey:m,enabled:!0};await Eo.getInstance().ping(g),new Hie.Notice("API key verified successfully!"),u(_=>{let S=new Set(_);return S.delete(h),S})}catch(v){console.error("API key verification failed:",v),new Hie.Notice("API key verification failed: "+ia(v),1e4)}finally{a(v=>{let g=new Set(v);return g.delete(h),g})}};return Ka.default.createElement(LM,{open:t,onOpenChange:l},Ka.default.createElement(TO,{container:o,className:"sm:max-w-[480px]"},Ka.default.createElement(MO,null,Ka.default.createElement(AO,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"},Zm(h.provider)),DA(h.provider).keyManagementURL&&Ka.default.createElement("a",{href:DA(h.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-accent hover:text-accent-hover"},"Get ",Zm(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(jM,{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(Ge,{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(wf,{className:"mr-2 h-4 w-4 animate-spin"}):"Verify")))))))))},x$t=kfn;var zu=B(Z()),C$t=require("obsidian"),O$t=B(lg());function Bfn({onConfirm:t,onCancel:e}){let r=me();return zu.default.createElement("div",{className:"flex flex-col gap-4"},zu.default.createElement("div",null,zu.default.createElement("p",null,"Thanks for purchasing ",zu.default.createElement("b",null,"Copilot Plus"),"! You have unlocked the full power of Copilot, featuring chat context, PDF and image support, exclusive chat and embedding models, and much more!"),zu.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),zu.default.createElement("ul",{className:"pl-4"},zu.default.createElement("li",null,"Default mode: ",zu.default.createElement("b",{className:"text-accent"},"Copilot Plus")),zu.default.createElement("li",null,"Chat model: ",zu.default.createElement("b",{className:"text-accent"},Zxe)),zu.default.createElement("li",null,zu.default.createElement("div",null,"Embedding model: ",zu.default.createElement("b",{className:"text-accent"},Qxe)),r.embeddingModelKey!==eCe&&zu.default.createElement("div",{className:"text-sm text-warning flex items-center gap-1"},zu.default.createElement(xh,{className:"size-4"})," It will rebuild your embeddings for the entire vault")))),zu.default.createElement("div",{className:"flex gap-2 justify-end w-full"},zu.default.createElement(Ge,{variant:"ghost",onClick:e},"Apply Later"),zu.default.createElement(Ge,{variant:"default",onClick:t},"Apply Now")))}var Vie=class extends C$t.Modal{constructor(r){super(r);this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:r}=this;this.root=(0,O$t.createRoot)(r);let n=()=>{Wvt(),this.close()},o=()=>{this.close()};this.root.render(zu.default.createElement(Bfn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var ds=B(Z());function E$t(){let t=Fa(),[e,r]=(0,ds.useState)(null),[n,o]=(0,ds.useState)(!1),i=tee(),[a,s]=(0,ds.useState)(t.plusLicenseKey);return(0,ds.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),ds.default.createElement("section",{className:"flex flex-col gap-4 bg-secondary p-4 rounded-lg"},ds.default.createElement("div",{className:"text-xl font-bold flex items-center gap-2 justify-between"},ds.default.createElement("span",null,"Copilot Plus (beta)"),i&&ds.default.createElement(Rm,{variant:"outline",className:"text-success"},"Active")),ds.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-2"},ds.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."),ds.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!")),ds.default.createElement("div",{className:"flex items-center gap-2"},ds.default.createElement(jM,{className:"w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),ds.default.createElement(Ge,{disabled:n,onClick:async()=>{Ft("plusLicenseKey",a),o(!0);let u=await ree();o(!1),u?(r(null),new Vie(app).open()):r("Invalid license key")},className:"min-w-20"},n?ds.default.createElement(wf,{className:"h-4 w-4 animate-spin"}):"Apply"),ds.default.createElement(Ge,{variant:"secondary",onClick:()=>DN(hE.SETTINGS)},"Join Now ",ds.default.createElement(rR,{className:"size-4"}))),ds.default.createElement("div",{className:"text-error"},e))}var qfn={["llm_chain"]:"Chat",["vault_qa"]:"Vault QA (Basic)",["copilot_plus"]:"Copilot Plus (beta)"},Ufn=({indexVaultToVectorStore:t})=>{let{modalContainer:e}=DS(),r=Fa(),[n,o]=(0,ve.useState)(!1),[i,a]=(0,ve.useState)(!1),[s,u]=(0,ve.useState)(r.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),l=async d=>{d!==r.embeddingModelKey&&new Y$(app,async()=>{Ft("embeddingModelKey",d),await t(!0)}).open()},c=()=>{a(!0);try{let d=s||"{$date}_{$time}__{$topic}",p=["{$date}","{$time}","{$topic}"].filter(S=>!d.includes(S));if(p.length>0){new X$.Notice(`Error: Missing required variables: ${p.join(", ")}`,4e3);return}let h=/[\\/:*?"<>|]/,m=d.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(h.test(m)){new X$.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:v}=ys(new Date),g="test topic name",_=d.replace("{$topic}",g.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",v.split("_")[0]).replace("{$time}",v.split("_")[1]);Ft("defaultConversationNoteName",d),u(d),new X$.Notice(`Format applied successfully! Example: ${_}`,4e3)}catch(d){new X$.Notice(`Error applying format: ${d.message}`,4e3)}finally{a(!1)}};return ve.default.createElement("div",{className:"space-y-4"},ve.default.createElement(E$t,null),ve.default.createElement("section",null,ve.default.createElement("div",{className:"text-xl font-bold mb-3"},"General"),ve.default.createElement("div",{className:"space-y-4"},ve.default.createElement("div",{className:"space-y-4"},ve.default.createElement(yo,{type:"custom",title:"API Keys",description:ve.default.createElement("div",{className:"flex items-center gap-1.5"},ve.default.createElement("span",{className:"leading-none"},"Configure API keys for different AI providers"),ve.default.createElement(gd,{delayDuration:0},ve.default.createElement(Jr,null,ve.default.createElement(Gr,{asChild:!0},ve.default.createElement(xl,{className:"size-4"})),ve.default.createElement(Hr,{className:"max-w-96 flex flex-col gap-2 py-4"},ve.default.createElement("div",{className:"text-sm font-medium text-accent"},"API key required for chat and QA features"),ve.default.createElement("div",{className:"text-xs text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider.")))))},ve.default.createElement(Ge,{onClick:()=>o(!0),variant:"secondary",className:"flex items-center gap-2 w-full sm:w-auto justify-center sm:justify-start"},"Set Keys",ve.default.createElement(wz,{className:"h-4 w-4"}))),ve.default.createElement(x$t,{open:n,onOpenChange:o,settings:r,updateSetting:Ft,modalContainer:e})),ve.default.createElement(yo,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:r.defaultModelKey,onChange:d=>{let f=r.activeModels.find(m=>m.enabled&&an(m)===d);if(!f)return;let{hasApiKey:p,errorNotice:h}=W5(f,r);if(!p&&h){new X$.Notice(h);return}Ft("defaultModelKey",d)},options:r.activeModels.filter(d=>d.enabled).map(d=>({label:fAe(d),value:an(d)})),placeholder:"Model"}),ve.default.createElement(yo,{type:"select",title:"Embedding Model",description:ve.default.createElement("div",{className:"space-y-2"},ve.default.createElement("div",{className:"flex items-center gap-1.5"},ve.default.createElement("span",{className:"leading-none font-medium text-accent"},"Core Feature: Powers Semantic Search & QA"),ve.default.createElement(gd,{delayDuration:0},ve.default.createElement(Jr,null,ve.default.createElement(Gr,{asChild:!0},ve.default.createElement(xl,{className:"size-4"})),ve.default.createElement(Hr,{className:"max-w-96 flex flex-col gap-2"},ve.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:"),ve.default.createElement("ul",{className:"text-sm text-muted pl-4"},ve.default.createElement("li",null,"Require rebuilding your vault's vector index"),ve.default.createElement("li",null,"Affect semantic search quality"),ve.default.createElement("li",null,"Impact QA feature performance"))))))),value:r.embeddingModelKey,onChange:l,options:r.activeEmbeddingModels.map(d=>({label:fAe(d),value:an(d)})),placeholder:"Model"}),ve.default.createElement(yo,{type:"select",title:"Default Mode",description:ve.default.createElement("div",{className:"flex items-center gap-1.5"},ve.default.createElement("span",{className:"leading-none"},"Select the default chat mode"),ve.default.createElement(gd,{delayDuration:0},ve.default.createElement(Jr,null,ve.default.createElement(Gr,{asChild:!0},ve.default.createElement(xl,{className:"size-4"})),ve.default.createElement(Hr,{className:"max-w-96 flex flex-col gap-2"},ve.default.createElement("ul",{className:"text-sm text-muted pl-4"},ve.default.createElement("li",null,ve.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",ve.default.createElement("i",null,"Free to use with your own API key.")),ve.default.createElement("li",null,ve.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",ve.default.createElement("i",null,"Free to use with your own API key.")),ve.default.createElement("li",null,ve.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"," ",ve.default.createElement("a",{href:tCe(hE.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))))),value:r.defaultChainType,onChange:d=>Ft("defaultChainType",d),options:Object.entries(qfn).map(([d,f])=>({label:f,value:d}))}),ve.default.createElement(yo,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:r.defaultOpenArea,onChange:d=>Ft("defaultOpenArea",d),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),ve.default.createElement(yo,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot-conversations'",value:r.defaultSaveFolder,onChange:d=>Ft("defaultSaveFolder",d),placeholder:"copilot-conversations"}),ve.default.createElement(yo,{type:"text",title:"Custom Prompts Folder Name",description:"The default folder name where custom prompts will be saved. Default is 'copilot-custom-prompts'",value:r.customPromptsFolder,onChange:d=>Ft("customPromptsFolder",d),placeholder:"copilot-custom-prompts"}),ve.default.createElement(yo,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:r.defaultConversationTag,onChange:d=>Ft("defaultConversationTag",d),placeholder:"ai-conversations"}),ve.default.createElement(yo,{type:"custom",title:"Conversation Filename Template",description:ve.default.createElement("div",{className:"flex items-start gap-1.5 "},ve.default.createElement("span",{className:"leading-none"},"Customize the format of saved conversation note names."),ve.default.createElement(gd,{delayDuration:0},ve.default.createElement(Jr,null,ve.default.createElement(Gr,{asChild:!0},ve.default.createElement(xl,{className:"size-4"})),ve.default.createElement(Hr,{className:"max-w-96 flex flex-col gap-2 py-4"},ve.default.createElement("div",{className:"text-sm font-medium text-accent"},"Note: All the following variables must be included in the template."),ve.default.createElement("div",null,ve.default.createElement("div",{className:"text-sm font-medium text-muted"},"Available variables:"),ve.default.createElement("ul",{className:"text-sm text-muted pl-4"},ve.default.createElement("li",null,ve.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),ve.default.createElement("li",null,ve.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),ve.default.createElement("li",null,ve.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),ve.default.createElement("i",{className:"text-sm text-muted mt-2"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},ve.default.createElement("div",{className:"flex items-center gap-1.5 w-[320px]"},ve.default.createElement(Ii,{type:"text",className:`transition-all duration-200 flex-grow min-w-[80px] ${i?"w-[80px]":"w-[120px]"}`,placeholder:"{$date}_{$time}__{$topic}",value:s,onChange:d=>u(d.target.value),disabled:i}),ve.default.createElement(Ge,{onClick:()=>c(),disabled:i,variant:"secondary"},i?ve.default.createElement(ve.default.Fragment,null,ve.default.createElement(wf,{className:"mr-2 h-4 w-4 animate-spin"}),"Apply"):"Apply"))),ve.default.createElement(yo,{type:"switch",title:"Autosave Chat",description:"Automatically save the chat when starting a new one or when the plugin reloads",checked:r.autosaveChat,onCheckedChange:d=>Ft("autosaveChat",d)}),ve.default.createElement(yo,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:r.showSuggestedPrompts,onCheckedChange:d=>Ft("showSuggestedPrompts",d)}),ve.default.createElement(yo,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:r.showRelevantNotes,onCheckedChange:d=>Ft("showRelevantNotes",d)}),ve.default.createElement(yo,{type:"dialog",title:"Command Settings",description:"Enable or disable builtin Copilot commands",dialogTitle:"Command Settings",dialogDescription:"Enable or disable chat commands",trigger:ve.default.createElement(Ge,{variant:"secondary"},"Manage Commands")},ve.default.createElement("div",{className:"h-[50vh] sm:h-[400px] overflow-y-auto px-1 py-2"},ve.default.createElement("div",{className:"space-y-4"},X5.map(d=>ve.default.createElement("div",{key:d,className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 py-2 sm:py-0.5"},ve.default.createElement("div",{className:"space-y-0.5 flex-1"},ve.default.createElement("div",{className:"text-sm font-medium"},Dy[d])),ve.default.createElement(MS,{checked:SD(d),onCheckedChange:f=>{let p={...r.enabledCommands,[d]:{enabled:f}};Ft("enabledCommands",p)}})))))))))},P$t=Ufn;var ta=B(Z());var ke=B(Z());var z6=require("obsidian");var Wie=B(Z());var T$t=B(Z(),1);var M$t=B(dt(),1),zfn="Label",A$t=T$t.forwardRef((t,e)=>(0,M$t.jsx)(Fn.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));A$t.displayName=zfn;var FRe=A$t;var Vfn=PN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),DO=Wie.forwardRef(({className:t,...e},r)=>Wie.createElement(FRe,{ref:r,className:Te(Vfn(),t),...e}));DO.displayName=FRe.displayName;var Zo=B(Z());var We=B(Z(),1),tIe=B(_s(),1);var Ia=B(Z(),1);var BRe=B(dt(),1),Wfn="DismissableLayer",kRe="dismissableLayer.update",Jfn="dismissableLayer.pointerDownOutside",Gfn="dismissableLayer.focusOutside",R$t,D$t=Ia.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$Re=Ia.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ia.useContext(D$t),[c,d]=Ia.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ia.useState({}),h=Vo(e,E=>d(E)),m=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(v),_=c?m.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,O=Xfn(E=>{let M=E.target,R=[...l.branches].some(N=>N.contains(M));!x||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),T=Zfn(E=>{let M=E.target;[...l.branches].some(N=>N.contains(M))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return OS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ia.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(R$t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),I$t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=R$t)}},[c,f,r,l]),Ia.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),I$t())},[c,l]),Ia.useEffect(()=>{let E=()=>p({});return document.addEventListener(kRe,E),()=>document.removeEventListener(kRe,E)},[]),(0,BRe.jsx)(Fn.div,{...u,ref:h,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:qo(t.onFocusCapture,T.onFocusCapture),onBlurCapture:qo(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:qo(t.onPointerDownCapture,O.onPointerDownCapture)})});$Re.displayName=Wfn;var Kfn="DismissableLayerBranch",Yfn=Ia.forwardRef((t,e)=>{let r=Ia.useContext(D$t),n=Ia.useRef(null),o=Vo(e,n);return Ia.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,BRe.jsx)(Fn.div,{...t,ref:o})});Yfn.displayName=Kfn;function Xfn(t,e=globalThis?.document){let r=Gt(t),n=Ia.useRef(!1),o=Ia.useRef(()=>{});return Ia.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){j$t(Jfn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Zfn(t,e=globalThis?.document){let r=Gt(t),n=Ia.useRef(!1);return Ia.useEffect(()=>{let o=i=>{i.target&&!n.current&&j$t(Gfn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function I$t(){let t=new CustomEvent(kRe);document.dispatchEvent(t)}function j$t(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?r$t(o,i):o.dispatchEvent(i)}var jm=B(Z(),1);var B$t=B(dt(),1),qRe="focusScope.autoFocusOnMount",URe="focusScope.autoFocusOnUnmount",N$t={bubbles:!1,cancelable:!0},Qfn="FocusScope",zRe=jm.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=jm.useState(null),l=Gt(o),c=Gt(i),d=jm.useRef(null),f=Vo(e,m=>u(m)),p=jm.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;jm.useEffect(()=>{if(n){let _=function(T){if(p.paused||!s)return;let E=T.target;s.contains(E)?d.current=E:BM(d.current,{select:!0})},S=function(T){if(p.paused||!s)return;let E=T.relatedTarget;E!==null&&(s.contains(E)||BM(d.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&BM(s)};var m=_,v=S,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),jm.useEffect(()=>{if(s){F$t.add(p);let m=document.activeElement;if(!s.contains(m)){let g=new CustomEvent(qRe,N$t);s.addEventListener(qRe,l),s.dispatchEvent(g),g.defaultPrevented||(epn(ipn($$t(s)),{select:!0}),document.activeElement===m&&BM(s))}return()=>{s.removeEventListener(qRe,l),setTimeout(()=>{let g=new CustomEvent(URe,N$t);s.addEventListener(URe,c),s.dispatchEvent(g),g.defaultPrevented||BM(m??document.body,{select:!0}),s.removeEventListener(URe,c),F$t.remove(p)},0)}}},[s,l,c,p]);let h=jm.useCallback(m=>{if(!r&&!n||p.paused)return;let v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(v&&g){let _=m.currentTarget,[S,x]=tpn(_);S&&x?!m.shiftKey&&g===x?(m.preventDefault(),r&&BM(S,{select:!0})):m.shiftKey&&g===S&&(m.preventDefault(),r&&BM(x,{select:!0})):g===_&&m.preventDefault()}},[r,n,p.paused]);return(0,B$t.jsx)(Fn.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});zRe.displayName=Qfn;function epn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(BM(n,{select:e}),document.activeElement!==r)return}function tpn(t){let e=$$t(t),r=L$t(e,t),n=L$t(e.reverse(),t);return[r,n]}function $$t(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function L$t(t,e){for(let r of t)if(!rpn(r,{upTo:e}))return r}function rpn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function npn(t){return t instanceof HTMLInputElement&&"select"in t}function BM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&npn(t)&&e&&t.select()}}var F$t=opn();function opn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=k$t(t,e),t.unshift(e)},remove(e){t=k$t(t,e),t[0]?.resume()}}}function k$t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function ipn(t){return t.filter(e=>e.tagName!=="A")}var Qp=B(Z(),1);var q$t=B(Z(),1);var HRe=B(dt(),1),apn="Arrow",U$t=q$t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,HRe.jsx)(Fn.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,HRe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});U$t.displayName=apn;var z$t=U$t;var jO=B(Z(),1),H$t=B(dt(),1);function V$t(t,e=[]){let r=[];function n(i,a){let s=jO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,v=jO.useMemo(()=>h,Object.values(h));return(0,H$t.jsx)(m.Provider,{value:v,children:p})}function c(d,f){let p=f?.[t][u]||s,h=jO.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=>jO.createContext(a));return function(s){let u=s?.[t]||i;return jO.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,upn(o,...e)]}function upn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return jO.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var $M=B(dt(),1);var VRe="Popper",[W$t,WRe]=V$t(VRe),[lpn,J$t]=W$t(VRe),G$t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Qp.useState(null);return(0,$M.jsx)(lpn,{scope:e,anchor:n,onAnchorChange:o,children:r})};G$t.displayName=VRe;var K$t="PopperAnchor",Y$t=Qp.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=J$t(K$t,r),a=Qp.useRef(null),s=Vo(e,a);return Qp.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,$M.jsx)(Fn.div,{...o,ref:s})});Y$t.displayName=K$t;var JRe="PopperContent",[cpn,dpn]=W$t(JRe),X$t=Qp.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:h,...m}=t,v=J$t(JRe,r),[g,_]=Qp.useState(null),S=Vo(e,le=>_(le)),[x,O]=Qp.useState(null),T=Tm(x),E=T?.width??0,M=T?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],k=j.length>0,F={padding:N,boundary:j.filter(ppn),altBoundary:k},{refs:L,floatingStyles:q,placement:U,isPositioned:G,middlewareData:V}=dM({strategy:"fixed",placement:R,whileElementsMounted:(...le)=>xO(...le,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[fM({mainAxis:o+M,alignmentAxis:a}),u&&pM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hM():void 0,...F}),u&&mM({...F}),gM({...F,apply:({elements:le,rects:Re,availableWidth:gt,availableHeight:Se})=>{let{width:ae,height:ee}=Re.reference,ye=le.floating.style;ye.setProperty("--radix-popper-available-width",`${gt}px`),ye.setProperty("--radix-popper-available-height",`${Se}px`),ye.setProperty("--radix-popper-anchor-width",`${ae}px`),ye.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),x&&bM({element:x,padding:s}),hpn({arrowWidth:E,arrowHeight:M}),f&&yM({strategy:"referenceHidden",...F})]}),[I,H]=eqt(U),W=Gt(h);qr(()=>{G&&W?.()},[G,W]);let J=V.arrow?.x,re=V.arrow?.y,Ae=V.arrow?.centerOffset!==0,[Y,Q]=Qp.useState();return qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,$M.jsx)("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:G?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,["--radix-popper-transform-origin"]:[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,$M.jsx)(cpn,{scope:r,placedSide:I,onArrowChange:O,arrowX:J,arrowY:re,shouldHideArrow:Ae,children:(0,$M.jsx)(Fn.div,{"data-side":I,"data-align":H,...m,ref:S,style:{...m.style,animation:G?void 0:"none"}})})})});X$t.displayName=JRe;var Z$t="PopperArrow",fpn={top:"bottom",right:"left",bottom:"top",left:"right"},Q$t=Qp.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=dpn(Z$t,n),a=fpn[i.placedSide];return(0,$M.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,$M.jsx)(z$t,{...o,ref:r,style:{...o.style,display:"block"}})})});Q$t.displayName=Z$t;function ppn(t){return t!==null}var hpn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=eqt(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 eqt(t){let[e,r="center"]=t.split("-");return[e,r]}var tqt=G$t,rqt=Y$t,nqt=X$t,oqt=Q$t;var Jie=B(Z(),1),iqt=B(_s(),1);var aqt=B(dt(),1),gpn="Portal",GRe=Jie.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Jie.useState(!1);qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?iqt.default.createPortal((0,aqt.jsx)(Fn.div,{...n,ref:e}),a):null});GRe.displayName=gpn;var sqt=B(Z(),1);var uqt=B(dt(),1),ypn="VisuallyHidden",KRe=sqt.forwardRef((t,e)=>(0,uqt.jsx)(Fn.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));KRe.displayName=ypn;var Lt=B(dt(),1),bpn=[" ","Enter","ArrowUp","ArrowDown"],_pn=[" ","Enter"],U6="Select",[Kie,Yie,vpn]=Uie(U6),[Z$,NWo]=No(U6,[vpn,WRe]),Xie=WRe(),[wpn,qM]=Z$(U6),[Spn,xpn]=Z$(U6),lqt=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:h}=t,m=Xie(e),[v,g]=We.useState(null),[_,S]=We.useState(null),[x,O]=We.useState(!1),T=uM(l),[E=!1,M]=ll({prop:n,defaultProp:o,onChange:i}),[R,N]=ll({prop:a,defaultProp:s,onChange:u}),j=We.useRef(null),k=v?h||!!v.closest("form"):!0,[F,L]=We.useState(new Set),q=Array.from(F).map(U=>U.props.value).join(";");return(0,Lt.jsx)(tqt,{...m,children:(0,Lt.jsxs)(wpn,{required:p,scope:e,trigger:v,onTriggerChange:g,valueNode:_,onValueNodeChange:S,valueNodeHasChildren:x,onValueNodeHasChildrenChange:O,contentId:Ga(),value:R,onValueChange:N,open:E,onOpenChange:M,dir:T,triggerPointerDownPosRef:j,disabled:f,children:[(0,Lt.jsx)(Kie.Provider,{scope:e,children:(0,Lt.jsx)(Spn,{scope:t.__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})}),k?(0,Lt.jsxs)(jqt,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:R,onChange:U=>N(U.target.value),disabled:f,form:h,children:[R===void 0?(0,Lt.jsx)("option",{value:""}):null,Array.from(F)]},q):null]})})};lqt.displayName=U6;var cqt="SelectTrigger",dqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=Xie(r),a=qM(cqt,r),s=a.disabled||n,u=Vo(e,a.onTriggerChange),l=Yie(r),c=We.useRef("touch"),[d,f,p]=Nqt(m=>{let v=l().filter(S=>!S.disabled),g=v.find(S=>S.value===a.value),_=Lqt(v,m,g);_!==void 0&&a.onValueChange(_.value)}),h=m=>{s||(a.onOpenChange(!0),p()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return(0,Lt.jsx)(rqt,{asChild:!0,...i,children:(0,Lt.jsx)(Fn.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":Dqt(a.value)?"":void 0,...o,ref:u,onClick:qo(o.onClick,m=>{m.currentTarget.focus(),c.current!=="mouse"&&h(m)}),onPointerDown:qo(o.onPointerDown,m=>{c.current=m.pointerType;let v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(h(m),m.preventDefault())}),onKeyDown:qo(o.onKeyDown,m=>{let v=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(v&&m.key===" ")&&bpn.includes(m.key)&&(h(),m.preventDefault())})})})});dqt.displayName=cqt;var fqt="SelectValue",pqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=qM(fqt,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Vo(e,u.onValueNodeChange);return qr(()=>{l(c)},[l,c]),(0,Lt.jsx)(Fn.span,{...s,ref:d,style:{pointerEvents:"none"},children:Dqt(u.value)?(0,Lt.jsx)(Lt.Fragment,{children:a}):i})});pqt.displayName=fqt;var Cpn="SelectIcon",hqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,Lt.jsx)(Fn.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});hqt.displayName=Cpn;var Opn="SelectPortal",mqt=t=>(0,Lt.jsx)(GRe,{asChild:!0,...t});mqt.displayName=Opn;var WD="SelectContent",gqt=We.forwardRef((t,e)=>{let r=qM(WD,t.__scopeSelect),[n,o]=We.useState();if(qr(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?tIe.createPortal((0,Lt.jsx)(yqt,{scope:t.__scopeSelect,children:(0,Lt.jsx)(Kie.Slot,{scope:t.__scopeSelect,children:(0,Lt.jsx)("div",{children:t.children})})}),i):null}return(0,Lt.jsx)(bqt,{...t,ref:e})});gqt.displayName=WD;var py=10,[yqt,UM]=Z$(WD),Epn="SelectContentImpl",bqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v,...g}=t,_=qM(WD,r),[S,x]=We.useState(null),[O,T]=We.useState(null),E=Vo(e,le=>x(le)),[M,R]=We.useState(null),[N,j]=We.useState(null),k=Yie(r),[F,L]=We.useState(!1),q=We.useRef(!1);We.useEffect(()=>{if(S)return SM(S)},[S]),lM();let U=We.useCallback(le=>{let[Re,...gt]=k().map(ee=>ee.ref.current),[Se]=gt.slice(-1),ae=document.activeElement;for(let ee of le)if(ee===ae||(ee?.scrollIntoView({block:"nearest"}),ee===Re&&O&&(O.scrollTop=0),ee===Se&&O&&(O.scrollTop=O.scrollHeight),ee?.focus(),document.activeElement!==ae))return},[k,O]),G=We.useCallback(()=>U([M,S]),[U,M,S]);We.useEffect(()=>{F&&G()},[F,G]);let{onOpenChange:V,triggerPointerDownPosRef:I}=_;We.useEffect(()=>{if(S){let le={x:0,y:0},Re=Se=>{le={x:Math.abs(Math.round(Se.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(Se.pageY)-(I.current?.y??0))}},gt=Se=>{le.x<=10&&le.y<=10?Se.preventDefault():S.contains(Se.target)||V(!1),document.removeEventListener("pointermove",Re),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",Re),document.addEventListener("pointerup",gt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Re),document.removeEventListener("pointerup",gt,{capture:!0})}}},[S,V,I]),We.useEffect(()=>{let le=()=>V(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[V]);let[H,W]=Nqt(le=>{let Re=k().filter(ae=>!ae.disabled),gt=Re.find(ae=>ae.ref.current===document.activeElement),Se=Lqt(Re,le,gt);Se&&setTimeout(()=>Se.ref.current.focus())}),J=We.useCallback((le,Re,gt)=>{let Se=!q.current&&!gt;(_.value!==void 0&&_.value===Re||Se)&&(R(le),Se&&(q.current=!0))},[_.value]),re=We.useCallback(()=>S?.focus(),[S]),Ae=We.useCallback((le,Re,gt)=>{let Se=!q.current&&!gt;(_.value!==void 0&&_.value===Re||Se)&&j(le)},[_.value]),Y=n==="popper"?YRe:_qt,Q=Y===YRe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:v}:{};return(0,Lt.jsx)(yqt,{scope:r,content:S,viewport:O,onViewportChange:T,itemRefCallback:J,selectedItem:M,onItemLeave:re,itemTextRefCallback:Ae,focusSelectedItem:G,selectedItemText:N,position:n,isPositioned:F,searchRef:H,children:(0,Lt.jsx)($6,{as:qy,allowPinchZoom:!0,children:(0,Lt.jsx)(zRe,{asChild:!0,trapped:_.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:qo(o,le=>{_.trigger?.focus({preventScroll:!0}),le.preventDefault()}),children:(0,Lt.jsx)($Re,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,Lt.jsx)(Y,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:le=>le.preventDefault(),...g,...Q,onPlaced:()=>L(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:qo(g.onKeyDown,le=>{let Re=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!Re&&le.key.length===1&&W(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let Se=k().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);if(["ArrowUp","End"].includes(le.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){let ae=le.target,ee=Se.indexOf(ae);Se=Se.slice(ee+1)}setTimeout(()=>U(Se)),le.preventDefault()}})})})})})})});bqt.displayName=Epn;var Ppn="SelectItemAlignedPosition",_qt=We.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=qM(WD,r),a=UM(WD,r),[s,u]=We.useState(null),[l,c]=We.useState(null),d=Vo(e,E=>c(E)),f=Yie(r),p=We.useRef(!1),h=We.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:g,focusSelectedItem:_}=a,S=We.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&m&&v&&g){let E=i.trigger.getBoundingClientRect(),M=l.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),N=g.getBoundingClientRect();if(i.dir!=="rtl"){let ae=N.left-M.left,ee=R.left-ae,ye=E.left-ee,Ue=E.width+ye,ft=Math.max(Ue,M.width),Je=window.innerWidth-py,cr=J$(ee,[py,Math.max(py,Je-ft)]);s.style.minWidth=Ue+"px",s.style.left=cr+"px"}else{let ae=M.right-N.right,ee=window.innerWidth-R.right-ae,ye=window.innerWidth-E.right-ee,Ue=E.width+ye,ft=Math.max(Ue,M.width),Je=window.innerWidth-py,cr=J$(ee,[py,Math.max(py,Je-ft)]);s.style.minWidth=Ue+"px",s.style.right=cr+"px"}let j=f(),k=window.innerHeight-py*2,F=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),I=q+U+F+V+G,H=Math.min(v.offsetHeight*5,I),W=window.getComputedStyle(m),J=parseInt(W.paddingTop,10),re=parseInt(W.paddingBottom,10),Ae=E.top+E.height/2-py,Y=k-Ae,Q=v.offsetHeight/2,le=v.offsetTop+Q,Re=q+U+le,gt=I-Re;if(Re<=Ae){let ae=j.length>0&&v===j[j.length-1].ref.current;s.style.bottom="0px";let ee=l.clientHeight-m.offsetTop-m.offsetHeight,ye=Math.max(Y,Q+(ae?re:0)+ee+G),Ue=Re+ye;s.style.height=Ue+"px"}else{let ae=j.length>0&&v===j[0].ref.current;s.style.top="0px";let ye=Math.max(Ae,q+m.offsetTop+(ae?J:0)+Q)+gt;s.style.height=ye+"px",m.scrollTop=Re-Ae+m.offsetTop}s.style.margin=`${py}px 0`,s.style.minHeight=H+"px",s.style.maxHeight=k+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,m,v,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(),_?.(),h.current=!1)},[S,_]);return(0,Lt.jsx)(Mpn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:(0,Lt.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,Lt.jsx)(Fn.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});_qt.displayName=Ppn;var Tpn="SelectPopperPosition",YRe=We.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=py,...i}=t,a=Xie(r);return(0,Lt.jsx)(nqt,{...a,...i,ref:e,align:n,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});YRe.displayName=Tpn;var[Mpn,rIe]=Z$(WD,{}),XRe="SelectViewport",vqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=UM(XRe,r),a=rIe(XRe,r),s=Vo(e,i.onViewportChange),u=We.useRef(0);return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.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,Lt.jsx)(Kie.Slot,{scope:r,children:(0,Lt.jsx)(Fn.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:qo(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-py*2,m=parseFloat(d.style.minHeight),v=parseFloat(d.style.height),g=Math.max(m,v);if(g<h){let _=g+p,S=Math.min(h,_),x=_-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})})})]})});vqt.displayName=XRe;var wqt="SelectGroup",[Apn,Rpn]=Z$(wqt),Ipn=We.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Ga();return(0,Lt.jsx)(Apn,{scope:r,id:o,children:(0,Lt.jsx)(Fn.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Ipn.displayName=wqt;var Sqt="SelectLabel",xqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Rpn(Sqt,r);return(0,Lt.jsx)(Fn.div,{id:o.id,...n,ref:e})});xqt.displayName=Sqt;var Gie="SelectItem",[Dpn,Cqt]=Z$(Gie),Oqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=qM(Gie,r),u=UM(Gie,r),l=s.value===n,[c,d]=We.useState(i??""),[f,p]=We.useState(!1),h=Vo(e,_=>u.itemRefCallback?.(_,n,o)),m=Ga(),v=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,Lt.jsx)(Dpn,{scope:r,value:n,disabled:o,textId:m,isSelected:l,onItemTextChange:We.useCallback(_=>{d(S=>S||(_?.textContent??"").trim())},[]),children:(0,Lt.jsx)(Kie.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,Lt.jsx)(Fn.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:qo(a.onFocus,()=>p(!0)),onBlur:qo(a.onBlur,()=>p(!1)),onClick:qo(a.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:qo(a.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:qo(a.onPointerDown,_=>{v.current=_.pointerType}),onPointerMove:qo(a.onPointerMove,_=>{v.current=_.pointerType,o?u.onItemLeave?.():v.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:qo(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:qo(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(_pn.includes(_.key)&&g(),_.key===" "&&_.preventDefault())})})})})});Oqt.displayName=Gie;var q6="SelectItemText",Eqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=qM(q6,r),s=UM(q6,r),u=Cqt(q6,r),l=xpn(q6,r),[c,d]=We.useState(null),f=Vo(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,h=We.useMemo(()=>(0,Lt.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=l;return qr(()=>(m(h),()=>v(h)),[m,v,h]),(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(Fn.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?tIe.createPortal(i.children,a.valueNode):null]})});Eqt.displayName=q6;var Pqt="SelectItemIndicator",Tqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return Cqt(Pqt,r).isSelected?(0,Lt.jsx)(Fn.span,{"aria-hidden":!0,...n,ref:e}):null});Tqt.displayName=Pqt;var ZRe="SelectScrollUpButton",Mqt=We.forwardRef((t,e)=>{let r=UM(ZRe,t.__scopeSelect),n=rIe(ZRe,t.__scopeSelect),[o,i]=We.useState(!1),a=Vo(e,n.onScrollButtonChange);return qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollTop>0;i(c)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,Lt.jsx)(Rqt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});Mqt.displayName=ZRe;var QRe="SelectScrollDownButton",Aqt=We.forwardRef((t,e)=>{let r=UM(QRe,t.__scopeSelect),n=rIe(QRe,t.__scopeSelect),[o,i]=We.useState(!1),a=Vo(e,n.onScrollButtonChange);return qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;i(d)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,Lt.jsx)(Rqt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});Aqt.displayName=QRe;var Rqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=UM("SelectScrollButton",r),a=We.useRef(null),s=Yie(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,Lt.jsx)(Fn.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:qo(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:qo(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:qo(o.onPointerLeave,()=>{u()})})}),jpn="SelectSeparator",Iqt=We.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,Lt.jsx)(Fn.div,{"aria-hidden":!0,...n,ref:e})});Iqt.displayName=jpn;var eIe="SelectArrow",Npn=We.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Xie(r),i=qM(eIe,r),a=UM(eIe,r);return i.open&&a.position==="popper"?(0,Lt.jsx)(oqt,{...o,...n,ref:e}):null});Npn.displayName=eIe;function Dqt(t){return t===""||t===void 0}var jqt=We.forwardRef((t,e)=>{let{value:r,...n}=t,o=We.useRef(null),i=Vo(e,o),a=G$(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,Lt.jsx)(KRe,{asChild:!0,children:(0,Lt.jsx)("select",{...n,ref:i,defaultValue:r})})});jqt.displayName="BubbleSelect";function Nqt(t){let e=Gt(t),r=We.useRef(""),n=We.useRef(0),o=We.useCallback(a=>{let s=r.current+a;e(s),function u(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}(s)},[e]),i=We.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return We.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function Lqt(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=Lpn(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function Lpn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Fqt=lqt,nIe=dqt,kqt=pqt,Bqt=hqt,$qt=mqt,oIe=gqt,qqt=vqt;var iIe=xqt,aIe=Oqt,Uqt=Eqt,zqt=Tqt,sIe=Mqt,uIe=Aqt,lIe=Iqt;var Hqt=Fqt;var Vqt=kqt,cIe=Zo.forwardRef(({className:t,children:e,...r},n)=>Zo.createElement(nIe,{ref:n,className:Te("border-solid !bg-dropdown !shadow-sm transition-colors","focus-visible:shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"," hover:data-[state=closed]:!bg-interactive-accent hover:data-[state=closed]:!text-on-accent","flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border px-3 py-1 text-sm ring-offset-ring placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r},e,Zo.createElement(Bqt,{asChild:!0},Zo.createElement(Sl,{className:"h-4 w-4"}))));cIe.displayName=nIe.displayName;var Wqt=Zo.forwardRef(({className:t,...e},r)=>Zo.createElement(sIe,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e},Zo.createElement(QA,{className:"h-4 w-4"})));Wqt.displayName=sIe.displayName;var Jqt=Zo.forwardRef(({className:t,...e},r)=>Zo.createElement(uIe,{ref:r,className:Te("flex cursor-default items-center justify-center py-1",t),...e},Zo.createElement(Sl,{className:"h-4 w-4"})));Jqt.displayName=uIe.displayName;var dIe=Zo.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>Zo.createElement($qt,{container:n},Zo.createElement(oIe,{ref:i,className:Te("relative z-modal max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-primary text-normal shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...o},Zo.createElement(Wqt,null),Zo.createElement(qqt,{className:Te("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},e),Zo.createElement(Jqt,null))));dIe.displayName=oIe.displayName;var kpn=Zo.forwardRef(({className:t,...e},r)=>Zo.createElement(iIe,{ref:r,className:Te("px-2 py-1.5 text-sm font-semibold",t),...e}));kpn.displayName=iIe.displayName;var fIe=Zo.forwardRef(({className:t,children:e,...r},n)=>Zo.createElement(aIe,{ref:n,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-interactive-accent focus:text-on-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r},Zo.createElement("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center"},Zo.createElement(zqt,null,Zo.createElement(cg,{className:"h-4 w-4"}))),Zo.createElement(Uqt,null,e)));fIe.displayName=aIe.displayName;var Bpn=Zo.forwardRef(({className:t,...e},r)=>Zo.createElement(lIe,{ref:r,className:Te("-mx-1 my-1 h-px bg-primary-alt",t),...e}));Bpn.displayName=lIe.displayName;var eq=B(Z());var eh=B(Z(),1);var Kqt=B(Z(),1);function Gqt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pIe(...t){return e=>{let r=!1,n=t.map(o=>{let i=Gqt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Gqt(t[o],null)}}}}function Yqt(...t){return Kqt.useCallback(pIe(...t),t)}function hIe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Xqt=B(Z(),1),Hpn=B(_s(),1);var Lc=B(Z(),1);var Q$=B(dt(),1),gIe=Lc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Lc.Children.toArray(r),i=o.find(qpn);if(i){let a=i.props.children,s=o.map(u=>u===i?Lc.Children.count(a)>1?Lc.Children.only(null):Lc.isValidElement(a)?a.props.children:null:u);return(0,Q$.jsx)(mIe,{...n,ref:e,children:Lc.isValidElement(a)?Lc.cloneElement(a,void 0,s):null})}return(0,Q$.jsx)(mIe,{...n,ref:e,children:r})});gIe.displayName="Slot";var mIe=Lc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Lc.isValidElement(r)){let o=zpn(r);return Lc.cloneElement(r,{...Upn(n,r.props),ref:e?pIe(e,o):o})}return Lc.Children.count(r)>1?Lc.Children.only(null):null});mIe.displayName="SlotClone";var $pn=({children:t})=>(0,Q$.jsx)(Q$.Fragment,{children:t});function qpn(t){return Lc.isValidElement(t)&&t.type===$pn}function Upn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function zpn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Zqt=B(dt(),1),Vpn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],yIe=Vpn.reduce((t,e)=>{let r=Xqt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?gIe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Zqt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var HM=B(dt(),1),bIe="Checkbox",[Wpn,eJo]=No(bIe),[Jpn,Gpn]=Wpn(bIe),Qqt=eh.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...d}=t,[f,p]=eh.useState(null),h=Yqt(e,x=>p(x)),m=eh.useRef(!1),v=f?c||!!f.closest("form"):!0,[g=!1,_]=ll({prop:o,defaultProp:i,onChange:l}),S=eh.useRef(g);return eh.useEffect(()=>{let x=f?.form;if(x){let O=()=>_(S.current);return x.addEventListener("reset",O),()=>x.removeEventListener("reset",O)}},[f,_]),(0,HM.jsxs)(Jpn,{scope:r,state:g,disabled:s,children:[(0,HM.jsx)(yIe.button,{type:"button",role:"checkbox","aria-checked":zM(g)?"mixed":g,"aria-required":a,"data-state":rUt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:h,onKeyDown:hIe(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:hIe(t.onClick,x=>{_(O=>zM(O)?!0:!O),v&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})}),v&&(0,HM.jsx)(Kpn,{control:f,bubbles:!m.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:zM(i)?!1:i})]})});Qqt.displayName=bIe;var eUt="CheckboxIndicator",tUt=eh.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Gpn(eUt,r);return(0,HM.jsx)($u,{present:n||zM(i.state)||i.state===!0,children:(0,HM.jsx)(yIe.span,{"data-state":rUt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});tUt.displayName=eUt;var Kpn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=eh.useRef(null),s=G$(r),u=Tm(e);eh.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=zM(r),p.call(c,zM(r)?!1:r),c.dispatchEvent(h)}},[s,r,n]);let l=eh.useRef(zM(r)?!1:r);return(0,HM.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??l.current,...i,tabIndex:-1,ref:a,style:{...t.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function zM(t){return t==="indeterminate"}function rUt(t){return zM(t)?"indeterminate":t?"checked":"unchecked"}var _Ie=Qqt,nUt=tUt;var hy=eq.forwardRef(({className:t,...e},r)=>eq.createElement(_Ie,{ref:r,className:Te("p-0 border-solid !bg-transparent !shadow transition-colors","hover:!bg-interactive-accent hover:!text-on-accent data-[state=checked]:!bg-interactive-accent data-[state=checked]:!text-on-accent","peer h-4 w-4 shrink-0 rounded-sm border border-interactive-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-interactive-accent data-[state=checked]:text-on-accent",t),...e},eq.createElement(nUt,{className:Te("flex items-center justify-center text-current")},eq.createElement(cg,{className:"h-4 w-4"}))));hy.displayName=_Ie.displayName;var tq=B(Z());var vd=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>tq.default.createElement("div",{className:"space-y-2"},tq.default.createElement(DO,{className:r?"text-error":""},t," ",e&&tq.default.createElement("span",{className:"text-error"},"*")),i,r&&tq.default.createElement("p",{className:"text-xs text-error"},o),n&&tq.default.createElement("p",{className:"text-sm text-muted"},n));var vIe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=DS(),a=me(),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}),v=(I,H)=>{m(W=>({...W,[I]:H}))},g=()=>{m({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let I=!0,H={...h};return H.name=!O.name,O.name||(I=!1),O.provider==="azure openai"&&(H.instanceName=!O.azureOpenAIApiInstanceName,H.apiVersion=!O.azureOpenAIApiVersion,o?(H.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(I=!1)):(H.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(I=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(I=!1)),m(H),I},S=I=>a[pE[I]]||"",x=(I=s)=>{let H={name:"",provider:I,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:S(I),isEmbeddingModel:o,capabilities:[]};return o?H:{...H,stream:!0}},[O,T]=(0,ke.useState)(x()),E=I=>({...I,name:I.name?.trim(),baseUrl:I.baseUrl?.trim(),apiKey:I.apiKey?.trim(),openAIOrgId:I.openAIOrgId?.trim(),azureOpenAIApiInstanceName:I.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:I.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:I.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:I.azureOpenAIApiVersion?.trim()}),[M,R]=(0,ke.useState)(DA(s)),N=()=>Boolean(O.name&&O.provider),j=()=>f||!N(),k=()=>{if(!_()){new z6.Notice("Please fill in all required fields");return}let I=E(O);r(I),e(!1),T(x()),g()},F=I=>{R(DA(I)),T({...O,provider:I,apiKey:S(I),...I==="openai"?{openAIOrgId:a.openAIOrgId}:{},...I==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},L=I=>{I||(T(x()),g(),d(!1)),e(I)},q=async()=>{if(!_()){new z6.Notice("Please fill in all required fields");return}p(!0);try{let I=E(O);await n(I),new z6.Notice("Model verification successful!")}catch(I){console.error(I);let H=ia(I);new z6.Notice("Model verification failed: "+H)}finally{p(!1)}},U=()=>{let H=(()=>{switch(O.provider){case"openai":return ke.default.createElement(vd,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},ke.default.createElement(Ii,{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(vd,{label:"Instance Name",required:!0,error:h.instanceName,errorMessage:"Instance name is required"},ke.default.createElement(Ii,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:W=>{T({...O,azureOpenAIApiInstanceName:W.target.value}),v("instanceName",!1)}})),o?ke.default.createElement(vd,{label:"Embedding Deployment Name",required:!0,error:h.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},ke.default.createElement(Ii,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:W=>{T({...O,azureOpenAIApiEmbeddingDeploymentName:W.target.value}),v("embeddingDeploymentName",!1)}})):ke.default.createElement(vd,{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(Ii,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:W=>{T({...O,azureOpenAIApiDeploymentName:W.target.value}),v("deploymentName",!1)}})),ke.default.createElement(vd,{label:"API Version",required:!0,error:h.apiVersion,errorMessage:"API version is required"},ke.default.createElement(Ii,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:W=>{T({...O,azureOpenAIApiVersion:W.target.value}),v("apiVersion",!1)}})));default:return null}})();return H?ke.default.createElement(vie,{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(DO,null,"Additional ",Zm(O.provider)," Settings"),ke.default.createElement(wie,{asChild:!0},ke.default.createElement(Ge,{variant:"ghost",size:"sm",className:"w-9 p-0"},ke.default.createElement(Sl,{className:"h-4 w-4"}),ke.default.createElement("span",{className:"sr-only"},"Toggle")))),ke.default.createElement(Sie,{className:"space-y-4 max-h-[200px] overflow-y-auto pl-0.5 pr-2 pb-0.5"},H)):null},G=()=>{if(O.provider!=="azure openai")return M.host;let I=O.azureOpenAIApiInstanceName||"[instance]",H=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",W=O.azureOpenAIApiVersion||"[api-version]";return`https://${I}.openai.azure.com/openai/deployments/${H}/${o?"embeddings":"chat/completions"}?api-version=${W}`},V=Object.entries(mE).map(([I,H])=>({id:I,label:I.charAt(0).toUpperCase()+I.slice(1),description:H}));return ke.default.createElement(LM,{open:t,onOpenChange:L},ke.default.createElement(TO,{className:"sm:max-w-[425px]",container:i,ref:I=>l(I)},ke.default.createElement(MO,null,ke.default.createElement(AO,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(vd,{label:"Model Name",required:!0,error:h.name,errorMessage:"Model name is required"},ke.default.createElement(Ii,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:I=>{T({...O,name:I.target.value}),v("name",!1)}})),ke.default.createElement(vd,{label:ke.default.createElement("div",{className:"flex items-center gap-1.5"},ke.default.createElement("span",{className:"leading-none"},"Display Name"),ke.default.createElement(gd,{delayDuration:0},ke.default.createElement(Jr,null,ke.default.createElement(Gr,{asChild:!0},ke.default.createElement(xl,{className:"size-4"})),ke.default.createElement(Hr,{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(Ii,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:I=>{T({...O,displayName:I.target.value})}})),ke.default.createElement(vd,{label:"Provider"},ke.default.createElement(Hqt,{value:O.provider,onValueChange:F},ke.default.createElement(cIe,null,ke.default.createElement(Vqt,{placeholder:"Select provider"})),ke.default.createElement(dIe,{container:u},Object.values(o?Tle(fE,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Tle(NA,["COPILOT_PLUS"])).map(I=>ke.default.createElement(fIe,{key:I,value:I},Zm(I)))))),ke.default.createElement(vd,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},ke.default.createElement(Ii,{type:"text",placeholder:G()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:I=>T({...O,baseUrl:I.target.value})})),ke.default.createElement(vd,{label:"API Key"},ke.default.createElement(jM,{placeholder:`Enter ${M.label} API Key`,value:O.apiKey||"",onChange:I=>T({...O,apiKey:I})}),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(vd,{label:"Model Capabilities"},ke.default.createElement("div",{className:"flex gap-4 items-center"},V.map(({id:I,label:H,description:W})=>ke.default.createElement("div",{key:I,className:"flex items-center gap-2"},ke.default.createElement(hy,{id:I,checked:O.capabilities?.includes(I),onCheckedChange:J=>{let re=O.capabilities||[];T({...O,capabilities:J?[...re,I]:re.filter(Ae=>Ae!==I)})}}),ke.default.createElement(DO,{htmlFor:I,className:"text-sm"},ke.default.createElement(gd,{delayDuration:0},ke.default.createElement(Jr,null,ke.default.createElement(Gr,{asChild:!0},ke.default.createElement("span",null,H)),ke.default.createElement(Hr,{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(hy,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:I=>T({...O,enableCors:I})}),ke.default.createElement(DO,{htmlFor:"enable-cors",className:"text-sm"},"Enable CORS")),ke.default.createElement("div",{className:"flex gap-2"},ke.default.createElement(Ge,{variant:"secondary",onClick:k,disabled:j()},"Add Model"),ke.default.createElement(Ge,{variant:"secondary",onClick:q,disabled:j()},f?ke.default.createElement(ke.default.Fragment,null,ke.default.createElement(wf,{className:"mr-2 h-4 w-4 animate-spin"}),"Verify"):"Verify")))))};var fl=B(Z());var wIe=fl.forwardRef(({className:t,...e},r)=>fl.createElement("div",{className:"relative w-full overflow-auto"},fl.createElement("table",{ref:r,className:Te("w-full caption-bottom text-sm border-collapse",t),...e})));wIe.displayName="Table";var SIe=fl.forwardRef(({className:t,...e},r)=>fl.createElement("thead",{ref:r,className:Te("[&_tr]:border-b",t),...e}));SIe.displayName="TableHeader";var xIe=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tbody",{ref:r,className:Te("[&_tr:last-child]:border-0",t),...e}));xIe.displayName="TableBody";var Xpn=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tfoot",{ref:r,className:Te("border-t bg-primary-alt/50 font-medium [&>tr]:last:border-b-0",t),...e}));Xpn.displayName="TableFooter";var Zie=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tr",{ref:r,className:Te("border-b transition-colors hover:bg-primary-alt/50 data-[state=selected]:bg-primary-alt",t),...e}));Zie.displayName="TableRow";var NO=fl.forwardRef(({className:t,...e},r)=>fl.createElement("th",{ref:r,className:Te("h-10 px-2 text-left align-middle font-medium text-muted [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));NO.displayName="TableHead";var LO=fl.forwardRef(({className:t,...e},r)=>fl.createElement("td",{ref:r,className:Te("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));LO.displayName="TableCell";var Zpn=fl.forwardRef(({className:t,...e},r)=>fl.createElement("caption",{ref:r,className:Te("mt-4 text-sm text-muted",t),...e}));Zpn.displayName="TableCaption";var $e=B(Z());var be=B(Z()),QD=B(_s());var fs=B(Z());function iUt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,fs.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var H6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function JD(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Qie(t){return"nodeType"in t}function tf(t){var e,r;return t?JD(t)?t:Qie(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function eae(t){let{Document:e}=tf(t);return t instanceof e}function rq(t){return JD(t)?!1:t instanceof tf(t).HTMLElement}function OIe(t){return t instanceof tf(t).SVGElement}function GD(t){return t?JD(t)?t.document:Qie(t)?eae(t)?t:rq(t)||OIe(t)?t.ownerDocument:document:document:document}var Nm=H6?fs.useLayoutEffect:fs.useEffect;function tae(t){let e=(0,fs.useRef)(t);return Nm(()=>{e.current=t}),(0,fs.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return e.current==null?void 0:e.current(...n)},[])}function aUt(){let t=(0,fs.useRef)(null),e=(0,fs.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,fs.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function nq(t,e){e===void 0&&(e=[t]);let r=(0,fs.useRef)(t);return Nm(()=>{r.current!==t&&(r.current=t)},e),r}function oq(t,e){let r=(0,fs.useRef)();return(0,fs.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function V6(t){let e=tae(t),r=(0,fs.useRef)(null),n=(0,fs.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function rae(t){let e=(0,fs.useRef)();return(0,fs.useEffect)(()=>{e.current=t},[t]),e.current}var CIe={};function KD(t,e){return(0,fs.useMemo)(()=>{if(e)return e;let r=CIe[t]==null?0:CIe[t]+1;return CIe[t]=r,t+"-"+r},[t,e])}function sUt(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{let s=Object.entries(a);for(let[u,l]of s){let c=i[u];c!=null&&(i[u]=c+t*l)}return i},{...e})}}var YD=sUt(1),XD=sUt(-1);function Qpn(t){return"clientX"in t&&"clientY"in t}function W6(t){if(!t)return!1;let{KeyboardEvent:e}=tf(t.target);return e&&t instanceof e}function ehn(t){if(!t)return!1;let{TouchEvent:e}=tf(t.target);return e&&t instanceof e}function nae(t){if(ehn(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:r}=t.touches[0];return{x:e,y:r}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:r}=t.changedTouches[0];return{x:e,y:r}}}return Qpn(t)?{x:t.clientX,y:t.clientY}:null}var FO=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:r}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:r}=t;return"scaleX("+e+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[FO.Translate.toString(t),FO.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),oUt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function uUt(t){return t.matches(oUt)?t:t.querySelector(oUt)}var ZD=B(Z()),thn={display:"none"};function lUt(t){let{id:e,value:r}=t;return ZD.default.createElement("div",{id:e,style:thn},r)}function cUt(t){let{id:e,announcement:r,ariaLiveType:n="assertive"}=t,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ZD.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function dUt(){let[t,e]=(0,ZD.useState)("");return{announce:(0,ZD.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var CUt=(0,be.createContext)(null);function rhn(t){let e=(0,be.useContext)(CUt);(0,be.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function nhn(){let[t]=(0,be.useState)(()=>new Set),e=(0,be.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,be.useCallback)(n=>{let{type:o,event:i}=n;t.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[t]),e]}var ohn={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.
`},ihn={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was moved over droppable area "+r.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was dropped over droppable area "+r.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function ahn(t){let{announcements:e=ihn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=ohn}=t,{announce:i,announcement:a}=dUt(),s=KD("DndLiveRegion"),[u,l]=(0,be.useState)(!1);if((0,be.useEffect)(()=>{l(!0)},[]),rhn((0,be.useMemo)(()=>({onDragStart(d){let{active:f}=d;i(e.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(e.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(e.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!u)return null;let c=be.default.createElement(be.default.Fragment,null,be.default.createElement(lUt,{id:n,value:o.draggable}),be.default.createElement(cUt,{id:s,announcement:a}));return r?(0,QD.createPortal)(c,r):c}var pl;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(pl||(pl={}));function iae(){}function jIe(t,e){return(0,be.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function OUt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,be.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var my=Object.freeze({x:0,y:0});function EUt(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function PUt(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function shn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function fUt(t){let{left:e,top:r,height:n,width:o}=t;return[{x:e,y:r},{x:e+o,y:r},{x:e,y:r+n},{x:e+o,y:r+n}]}function NIe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function pUt(t,e,r){return e===void 0&&(e=t.left),r===void 0&&(r=t.top),{x:e+t.width*.5,y:r+t.height*.5}}var LIe=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=pUt(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=EUt(pUt(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(PUt)},TUt=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=fUt(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=fUt(u),c=o.reduce((f,p,h)=>f+EUt(l[h],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(PUt)};function uhn(t,e){let r=Math.max(e.top,t.top),n=Math.max(e.left,t.left),o=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=o-n,s=i-r;if(n<o&&r<i){let u=e.width*e.height,l=t.width*t.height,c=a*s,d=c/(u+l-c);return Number(d.toFixed(4))}return 0}var lhn=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=[];for(let i of n){let{id:a}=i,s=r.get(a);if(s){let u=uhn(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(shn)};function chn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function MUt(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:my}function dhn(t){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+t*s.y,bottom:a.bottom+t*s.y,left:a.left+t*s.x,right:a.right+t*s.x}),{...r})}}var fhn=dhn(1);function phn(t){if(t.startsWith("matrix3d(")){let e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){let e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function hhn(t,e,r){let n=phn(e);if(!n)return t;let{scaleX:o,scaleY:i,x:a,y:s}=n,u=t.left-a-(1-o)*parseFloat(r),l=t.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?t.width/o:t.width,d=i?t.height/i:t.height;return{width:c,height:d,top:l,right:u+c,bottom:l+d,left:u}}var mhn={ignoreTransform:!1};function rj(t,e){e===void 0&&(e=mhn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=tf(t).getComputedStyle(t);l&&(r=hhn(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 hUt(t){return rj(t,{ignoreTransform:!0})}function ghn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function yhn(t,e){return e===void 0&&(e=tf(t).getComputedStyle(t)),e.position==="fixed"}function bhn(t,e){e===void 0&&(e=tf(t).getComputedStyle(t));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{let i=e[o];return typeof i=="string"?r.test(i):!1})}function X6(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(eae(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!rq(o)||OIe(o)||r.includes(o))return r;let i=tf(t).getComputedStyle(o);return o!==t&&bhn(o,i)&&r.push(o),yhn(o,i)?r:n(o.parentNode)}return t?n(t):r}function AUt(t){let[e]=X6(t,1);return e??null}function EIe(t){return!H6||!t?null:JD(t)?t:Qie(t)?eae(t)||t===GD(t).scrollingElement?window:rq(t)?t:null:null}function RUt(t){return JD(t)?t.scrollX:t.scrollLeft}function IUt(t){return JD(t)?t.scrollY:t.scrollTop}function MIe(t){return{x:RUt(t),y:IUt(t)}}var Hl;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Hl||(Hl={}));function DUt(t){return!H6||!t?!1:t===document.scrollingElement}function jUt(t){let e={x:0,y:0},r=DUt(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},o=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=n.y,s=t.scrollLeft>=n.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:n,minScroll:e}}var _hn={x:.2,y:.2};function vhn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=_hn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=jUt(t),p={x:0,y:0},h={x:0,y:0},m={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+m.height?(p.y=Hl.Backward,h.y=n*Math.abs((e.top+m.height-i)/m.height)):!c&&u>=e.bottom-m.height&&(p.y=Hl.Forward,h.y=n*Math.abs((e.bottom-m.height-u)/m.height)),!f&&s>=e.right-m.width?(p.x=Hl.Forward,h.x=n*Math.abs((e.right-m.width-s)/m.width)):!d&&a<=e.left+m.width&&(p.x=Hl.Backward,h.x=n*Math.abs((e.left+m.width-a)/m.width)),{direction:p,speed:h}}function whn(t){if(t===document.scrollingElement){let{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}let{top:e,left:r,right:n,bottom:o}=t.getBoundingClientRect();return{top:e,left:r,right:n,bottom:o,width:t.clientWidth,height:t.clientHeight}}function NUt(t){return t.reduce((e,r)=>YD(e,MIe(r)),my)}function Shn(t){return t.reduce((e,r)=>e+RUt(r),0)}function xhn(t){return t.reduce((e,r)=>e+IUt(r),0)}function Chn(t,e){if(e===void 0&&(e=rj),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);AUt(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var Ohn=[["x",["left","right"],Shn],["y",["top","bottom"],xhn]],G6=class{constructor(e,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=X6(r),o=NUt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of Ohn)for(let u of a)Object.defineProperty(this,u,{get:()=>{let l=s(n),c=o[i]-l;return this.rect[u]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},ej=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=e}add(e,r,n){var o;(o=this.target)==null||o.addEventListener(e,r,n),this.listeners.push([e,r,n])}};function Ehn(t){let{EventTarget:e}=tf(t);return t instanceof e?t:GD(t)}function PIe(t,e){let r=Math.abs(t.x),n=Math.abs(t.y);return typeof e=="number"?Math.sqrt(r**2+n**2)>e:"x"in e&&"y"in e?r>e.x&&n>e.y:"x"in e?r>e.x:"y"in e?n>e.y:!1}var Lm;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Lm||(Lm={}));function mUt(t){t.preventDefault()}function Phn(t){t.stopPropagation()}var hn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(hn||(hn={}));var LUt={start:[hn.Space,hn.Enter],cancel:[hn.Esc],end:[hn.Space,hn.Enter,hn.Tab]},Thn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.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}}},iq=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:r}}=e;this.props=e,this.listeners=new ej(GD(r)),this.windowListeners=new ej(tf(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Lm.Resize,this.handleCancel),this.windowListeners.add(Lm.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Lm.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&Chn(n),r(my)}handleKeyDown(e){if(W6(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=LUt,coordinateGetter:a=Thn,scrollBehavior:s="smooth"}=o,{code:u}=e;if(i.end.includes(u)){this.handleEnd(e);return}if(i.cancel.includes(u)){this.handleCancel(e);return}let{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:my;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=XD(d,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let v=e.code,{isTop:g,isRight:_,isLeft:S,isBottom:x,maxScroll:O,minScroll:T}=jUt(m),E=whn(m),M={x:Math.min(v===hn.Right?E.right-E.width/2:E.right,Math.max(v===hn.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(v===hn.Down?E.bottom-E.height/2:E.bottom,Math.max(v===hn.Down?E.top:E.top+E.height/2,d.y))},R=v===hn.Right&&!_||v===hn.Left&&!S,N=v===hn.Down&&!x||v===hn.Up&&!g;if(R&&M.x!==d.x){let j=m.scrollLeft+f.x,k=v===hn.Right&&j<=O.x||v===hn.Left&&j>=T.x;if(k&&!f.y){m.scrollTo({left:j,behavior:s});return}k?p.x=m.scrollLeft-j:p.x=v===hn.Right?m.scrollLeft-O.x:m.scrollLeft-T.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(N&&M.y!==d.y){let j=m.scrollTop+f.y,k=v===hn.Down&&j<=O.y||v===hn.Up&&j>=T.y;if(k&&!f.x){m.scrollTo({top:j,behavior:s});return}k?p.y=m.scrollTop-j:p.y=v===hn.Down?m.scrollTop-O.y:m.scrollTop-T.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,YD(XD(d,this.referenceCoordinates),p))}}}handleMove(e,r){let{onMove:n}=this.props;e.preventDefault(),n(r)}handleEnd(e){let{onEnd:r}=this.props;e.preventDefault(),this.detach(),r()}handleCancel(e){let{onCancel:r}=this.props;e.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};iq.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=LUt,onActivation:o}=e,{active:i}=r,{code:a}=t.nativeEvent;if(n.start.includes(a)){let s=i.activatorNode.current;return s&&t.target!==s?!1:(t.preventDefault(),o?.({event:t.nativeEvent}),!0)}return!1}}];function gUt(t){return Boolean(t&&"distance"in t)}function yUt(t){return Boolean(t&&"delay"in t)}var K6=class{constructor(e,r,n){var o;n===void 0&&(n=Ehn(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=r;let{event:i}=e,{target:a}=i;this.props=e,this.events=r,this.document=GD(a),this.documentListeners=new ej(this.document),this.listeners=new ej(n),this.windowListeners=new ej(tf(a)),this.initialCoordinates=(o=nae(i))!=null?o:my,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Lm.Resize,this.handleCancel),this.windowListeners.add(Lm.DragStart,mUt),this.windowListeners.add(Lm.VisibilityChange,this.handleCancel),this.windowListeners.add(Lm.ContextMenu,mUt),this.documentListeners.add(Lm.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(yUt(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gUt(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,r){let{active:n,onPending:o}=this.props;o(n,e,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:e}=this,{onStart:r}=this.props;e&&(this.activated=!0,this.documentListeners.add(Lm.Click,Phn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Lm.SelectionChange,this.removeTextSelection),r(e))}handleMove(e){var r;let{activated:n,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;let u=(r=nae(e))!=null?r:my,l=XD(o,u);if(!n&&s){if(gUt(s)){if(s.tolerance!=null&&PIe(l,s.tolerance))return this.handleCancel();if(PIe(l,s.distance))return this.handleStart()}if(yUt(s)&&PIe(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}e.cancelable&&e.preventDefault(),a(u)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===hn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Mhn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},aq=class extends K6{constructor(e){let{event:r}=e,n=GD(r.target);super(e,Mhn,n)}};aq.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var Ahn={move:{name:"mousemove"},end:{name:"mouseup"}},AIe;(function(t){t[t.RightClick=2]="RightClick"})(AIe||(AIe={}));var RIe=class extends K6{constructor(e){super(e,Ahn,GD(e.event.target))}};RIe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===AIe.RightClick?!1:(n?.({event:r}),!0)}}];var TIe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},IIe=class extends K6{constructor(e){super(e,TIe)}static setup(){return window.addEventListener(TIe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(TIe.move.name,e)};function e(){}}};IIe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e,{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var J6;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(J6||(J6={}));var aae;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(aae||(aae={}));function Rhn(t){let{acceleration:e,activator:r=J6.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=aae.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=Dhn({delta:d,disabled:!i}),[h,m]=aUt(),v=(0,be.useRef)({x:0,y:0}),g=(0,be.useRef)({x:0,y:0}),_=(0,be.useMemo)(()=>{switch(r){case J6.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case J6.DraggableRect:return o}},[r,o,u]),S=(0,be.useRef)(null),x=(0,be.useCallback)(()=>{let T=S.current;if(!T)return;let E=v.current.x*g.current.x,M=v.current.y*g.current.y;T.scrollBy(E,M)},[]),O=(0,be.useMemo)(()=>s===aae.TreeOrder?[...l].reverse():l,[s,l]);(0,be.useEffect)(()=>{if(!i||!l.length||!_){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:R,speed:N}=vhn(T,M,_,e,f);for(let j of["x","y"])p[j][R[j]]||(N[j]=0,R[j]=0);if(N.x>0||N.y>0){m(),S.current=T,h(x,a),v.current=N,g.current=R;return}}v.current={x:0,y:0},g.current={x:0,y:0},m()},[e,x,n,m,i,a,JSON.stringify(_),JSON.stringify(p),h,l,O,c,JSON.stringify(f)])}var Ihn={x:{[Hl.Backward]:!1,[Hl.Forward]:!1},y:{[Hl.Backward]:!1,[Hl.Forward]:!1}};function Dhn(t){let{delta:e,disabled:r}=t,n=rae(e);return oq(o=>{if(r||!n||!o)return Ihn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Hl.Backward]:o.x[Hl.Backward]||i.x===-1,[Hl.Forward]:o.x[Hl.Forward]||i.x===1},y:{[Hl.Backward]:o.y[Hl.Backward]||i.y===-1,[Hl.Forward]:o.y[Hl.Forward]||i.y===1}}},[r,e,n])}function jhn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return oq(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function Nhn(t,e){return(0,be.useMemo)(()=>t.reduce((r,n)=>{let{sensor:o}=n,i=o.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...r,...i]},[]),[t,e])}var Y6;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Y6||(Y6={}));var DIe;(function(t){t.Optimized="optimized"})(DIe||(DIe={}));var bUt=new Map;function Lhn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,be.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,be.useRef)(t),d=v(),f=nq(d),p=(0,be.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(_=>_===null?g:_.concat(g.filter(S=>!_.includes(S))))},[f]),h=(0,be.useRef)(null),m=oq(g=>{if(d&&!r)return bUt;if(!g||g===bUt||c.current!==t||i!=null){let _=new Map;for(let S of t){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){_.set(S.id,S.rect.current);continue}let x=S.node.current,O=x?new G6(u(x),x):null;S.rect.current=O,O&&_.set(S.id,O)}return _}return g},[t,i,r,d,u]);return(0,be.useEffect)(()=>{c.current=t},[t]),(0,be.useEffect)(()=>{d||p()},[r,d]),(0,be.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,be.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 v(){switch(l){case Y6.Always:return!1;case Y6.BeforeDragging:return r;default:return!r}}}function FUt(t,e){return oq(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function Fhn(t,e){return FUt(t,e)}function khn(t){let{callback:e,disabled:r}=t,n=tae(e),o=(0,be.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,be.useEffect)(()=>()=>o?.disconnect(),[o]),o}function sae(t){let{callback:e,disabled:r}=t,n=tae(e),o=(0,be.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,be.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Bhn(t){return new G6(rj(t),t)}function _Ut(t,e,r){e===void 0&&(e=Bhn);let[n,o]=(0,be.useState)(null);function i(){o(u=>{if(!t)return null;if(t.isConnected===!1){var l;return(l=u??r)!=null?l:null}let c=e(t);return JSON.stringify(u)===JSON.stringify(c)?u:c})}let a=khn({callback(u){if(t)for(let l of u){let{type:c,target:d}=l;if(c==="childList"&&d instanceof HTMLElement&&d.contains(t)){i();break}}}}),s=sae({callback:i});return Nm(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function $hn(t){let e=FUt(t);return MUt(t,e)}var vUt=[];function qhn(t){let e=(0,be.useRef)(t),r=oq(n=>t?n&&n!==vUt&&t&&e.current&&t.parentNode===e.current.parentNode?n:X6(t):vUt,[t]);return(0,be.useEffect)(()=>{e.current=t},[t]),r}function Uhn(t){let[e,r]=(0,be.useState)(null),n=(0,be.useRef)(t),o=(0,be.useCallback)(i=>{let a=EIe(i.target);a&&r(s=>s?(s.set(a,MIe(a)),new Map(s)):null)},[]);return(0,be.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=EIe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,MIe(l)]):null}).filter(u=>u!=null);r(s.length?new Map(s):null),n.current=t}return()=>{a(t),a(i)};function a(s){s.forEach(u=>{let l=EIe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,be.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>YD(i,a),my):NUt(t):my,[t,e])}function wUt(t,e){e===void 0&&(e=[]);let r=(0,be.useRef)(null);return(0,be.useEffect)(()=>{r.current=null},e),(0,be.useEffect)(()=>{let n=t!==my;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?XD(t,r.current):my}function zhn(t){(0,be.useEffect)(()=>{if(!H6)return;let e=t.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of e)r?.()}},t.map(e=>{let{sensor:r}=e;return r}))}function Hhn(t,e){return(0,be.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function kUt(t){return(0,be.useMemo)(()=>t?ghn(t):null,[t])}var SUt=[];function Vhn(t,e){e===void 0&&(e=rj);let[r]=t,n=kUt(r?tf(r):null),[o,i]=(0,be.useState)(SUt);function a(){i(()=>t.length?t.map(u=>DUt(u)?n:new G6(e(u),u)):SUt)}let s=sae({callback:a});return Nm(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function Whn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return rq(e)?e:t}function Jhn(t){let{measure:e}=t,[r,n]=(0,be.useState)(null),o=(0,be.useCallback)(l=>{for(let{target:c}of l)if(rq(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=sae({callback:o}),a=(0,be.useCallback)(l=>{let c=Whn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=V6(a);return(0,be.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var Ghn=[{sensor:aq,options:{}},{sensor:iq,options:{}}],Khn={current:{}},oae={draggable:{measure:hUt},droppable:{measure:hUt,strategy:Y6.WhileDragging,frequency:DIe.Optimized},dragOverlay:{measure:rj}},tj=class extends Map{get(e){var r;return e!=null&&(r=super.get(e))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:r}=e;return!r})}getNodeFor(e){var r,n;return(r=(n=this.get(e))==null?void 0:n.node.current)!=null?r:void 0}},Yhn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tj,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:iae},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oae,measureDroppableContainers:iae,windowRect:null,measuringScheduled:!1},Xhn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:iae,draggableNodes:new Map,over:null,measureDroppableContainers:iae},uae=(0,be.createContext)(Xhn),BUt=(0,be.createContext)(Yhn);function Zhn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tj}}}function Qhn(t,e){switch(e.type){case pl.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case pl.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case pl.DragEnd:case pl.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pl.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new tj(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case pl.SetDroppableDisabled:{let{id:r,key:n,disabled:o}=e,i=t.droppable.containers.get(r);if(!i||n!==i.key)return t;let a=new tj(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case pl.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new tj(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function emn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,be.useContext)(uae),i=rae(n),a=rae(r?.id);return(0,be.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!W6(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=uUt(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function tmn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function rmn(t){return(0,be.useMemo)(()=>({draggable:{...oae.draggable,...t?.draggable},droppable:{...oae.droppable,...t?.droppable},dragOverlay:{...oae.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function nmn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,be.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Nm(()=>{if(!a&&!s||!e){i.current=!1;return}if(i.current||!n)return;let l=e?.node.current;if(!l||l.isConnected===!1)return;let c=r(l),d=MUt(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=AUt(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var $Ut=(0,be.createContext)({...my,scaleX:1,scaleY:1}),VM;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(VM||(VM={}));var FIe=(0,be.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=Ghn,collisionDetection:d=lhn,measuring:f,modifiers:p,...h}=e,m=(0,be.useReducer)(Qhn,void 0,Zhn),[v,g]=m,[_,S]=nhn(),[x,O]=(0,be.useState)(VM.Uninitialized),T=x===VM.Initialized,{draggable:{active:E,nodes:M,translate:R},droppable:{containers:N}}=v,j=E!=null?M.get(E):null,k=(0,be.useRef)({initial:null,translated:null}),F=(0,be.useMemo)(()=>{var ja;return E!=null?{id:E,data:(ja=j?.data)!=null?ja:Khn,rect:k}:null},[E,j]),L=(0,be.useRef)(null),[q,U]=(0,be.useState)(null),[G,V]=(0,be.useState)(null),I=nq(h,Object.values(h)),H=KD("DndDescribedBy",a),W=(0,be.useMemo)(()=>N.getEnabled(),[N]),J=rmn(f),{droppableRects:re,measureDroppableContainers:Ae,measuringScheduled:Y}=Lhn(W,{dragging:T,dependencies:[R.x,R.y],config:J.droppable}),Q=jhn(M,E),le=(0,be.useMemo)(()=>G?nae(G):null,[G]),Re=qO(),gt=Fhn(Q,J.draggable.measure);nmn({activeNode:E!=null?M.get(E):null,config:Re.layoutShiftCompensation,initialRect:gt,measure:J.draggable.measure});let Se=_Ut(Q,J.draggable.measure,gt),ae=_Ut(Q?Q.parentElement:null),ee=(0,be.useRef)({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ye=N.getNodeFor((r=ee.current.over)==null?void 0:r.id),Ue=Jhn({measure:J.dragOverlay.measure}),ft=(n=Ue.nodeRef.current)!=null?n:Q,Je=T?(o=Ue.rect)!=null?o:Se:null,cr=Boolean(Ue.nodeRef.current&&Ue.rect),Yr=$hn(cr?null:Se),dr=kUt(ft?tf(ft):null),qt=qhn(T?ye??Q:null),Uo=Vhn(qt),ra=tmn(p,{transform:{x:R.x-Yr.x,y:R.y-Yr.y,scaleX:1,scaleY:1},activatorEvent:G,active:F,activeNodeRect:Se,containerNodeRect:ae,draggingNodeRect:Je,over:ee.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:qt,scrollableAncestorRects:Uo,windowRect:dr}),Fo=le?YD(le,R):null,Ie=Uhn(qt),Xe=wUt(Ie),fr=wUt(Ie,[Se]),Ze=YD(ra,Xe),$n=Je?fhn(Je,ra):null,na=F&&$n?d({active:F,collisionRect:$n,droppableRects:re,droppableContainers:W,pointerCoordinates:Fo}):null,hl=NIe(na,"id"),[Fc,km]=(0,be.useState)(null),Bm=cr?ra:YD(ra,fr),Da=chn(Bm,(i=Fc?.rect)!=null?i:null,Se),th=(0,be.useRef)(null),ep=(0,be.useCallback)((ja,hs)=>{let{sensor:oa,options:wd}=hs;if(L.current==null)return;let kc=M.get(L.current);if(!kc)return;let Ya=ja.nativeEvent,rf=new oa({active:L.current,activeNode:kc,event:Ya,options:wd,context:ee,onAbort(rn){if(!M.get(rn))return;let{onDragAbort:xd}=I.current,tp={id:rn};xd?.(tp),_({type:"onDragAbort",event:tp})},onPending(rn,je,xd,tp){if(!M.get(rn))return;let{onDragPending:NS}=I.current,Xr={id:rn,constraint:je,initialCoordinates:xd,offset:tp};NS?.(Xr),_({type:"onDragPending",event:Xr})},onStart(rn){let je=L.current;if(je==null)return;let xd=M.get(je);if(!xd)return;let{onDragStart:tp}=I.current,Hu={activatorEvent:Ya,active:{id:je,data:xd.data,rect:k}};(0,QD.unstable_batchedUpdates)(()=>{tp?.(Hu),O(VM.Initializing),g({type:pl.DragStart,initialCoordinates:rn,active:je}),_({type:"onDragStart",event:Hu}),U(th.current),V(Ya)})},onMove(rn){g({type:pl.DragMove,coordinates:rn})},onEnd:Sd(pl.DragEnd),onCancel:Sd(pl.DragCancel)});th.current=rf;function Sd(rn){return async function(){let{active:xd,collisions:tp,over:Hu,scrollAdjustedTranslate:NS}=ee.current,Xr=null;if(xd&&NS){let{cancelDrop:$m}=I.current;Xr={activatorEvent:Ya,active:xd,collisions:tp,delta:NS,over:Hu},rn===pl.DragEnd&&typeof $m=="function"&&await Promise.resolve($m(Xr))&&(rn=pl.DragCancel)}L.current=null,(0,QD.unstable_batchedUpdates)(()=>{g({type:rn}),O(VM.Uninitialized),km(null),U(null),V(null),th.current=null;let $m=rn===pl.DragEnd?"onDragEnd":"onDragCancel";if(Xr){let sq=I.current[$m];sq?.(Xr),_({type:$m,event:Xr})}})}}},[M]),rh=(0,be.useCallback)((ja,hs)=>(oa,wd)=>{let kc=oa.nativeEvent,Ya=M.get(wd);if(L.current!==null||!Ya||kc.dndKit||kc.defaultPrevented)return;let rf={active:Ya};ja(oa,hs.options,rf)===!0&&(kc.dndKit={capturedBy:hs.sensor},L.current=wd,ep(oa,hs))},[M,ep]),gn=Nhn(c,rh);zhn(c),Nm(()=>{Se&&x===VM.Initializing&&O(VM.Initialized)},[Se,x]),(0,be.useEffect)(()=>{let{onDragMove:ja}=I.current,{active:hs,activatorEvent:oa,collisions:wd,over:kc}=ee.current;if(!hs||!oa)return;let Ya={active:hs,activatorEvent:oa,collisions:wd,delta:{x:Ze.x,y:Ze.y},over:kc};(0,QD.unstable_batchedUpdates)(()=>{ja?.(Ya),_({type:"onDragMove",event:Ya})})},[Ze.x,Ze.y]),(0,be.useEffect)(()=>{let{active:ja,activatorEvent:hs,collisions:oa,droppableContainers:wd,scrollAdjustedTranslate:kc}=ee.current;if(!ja||L.current==null||!hs||!kc)return;let{onDragOver:Ya}=I.current,rf=wd.get(hl),Sd=rf&&rf.rect.current?{id:rf.id,rect:rf.rect.current,data:rf.data,disabled:rf.disabled}:null,rn={active:ja,activatorEvent:hs,collisions:oa,delta:{x:kc.x,y:kc.y},over:Sd};(0,QD.unstable_batchedUpdates)(()=>{km(Sd),Ya?.(rn),_({type:"onDragOver",event:rn})})},[hl]),Nm(()=>{ee.current={activatorEvent:G,active:F,activeNode:Q,collisionRect:$n,collisions:na,droppableRects:re,draggableNodes:M,draggingNode:ft,draggingNodeRect:Je,droppableContainers:N,over:Fc,scrollableAncestors:qt,scrollAdjustedTranslate:Ze},k.current={initial:Je,translated:$n}},[F,Q,na,$n,M,ft,Je,re,N,Fc,qt,Ze]),Rhn({...Re,delta:R,draggingRect:$n,pointerCoordinates:Fo,scrollableAncestors:qt,scrollableAncestorRects:Uo});let $O=(0,be.useMemo)(()=>({active:F,activeNode:Q,activeNodeRect:Se,activatorEvent:G,collisions:na,containerNodeRect:ae,dragOverlay:Ue,draggableNodes:M,droppableContainers:N,droppableRects:re,over:Fc,measureDroppableContainers:Ae,scrollableAncestors:qt,scrollableAncestorRects:Uo,measuringConfiguration:J,measuringScheduled:Y,windowRect:dr}),[F,Q,Se,G,na,ae,Ue,M,N,re,Fc,Ae,qt,Uo,J,Y,dr]),WM=(0,be.useMemo)(()=>({activatorEvent:G,activators:gn,active:F,activeNodeRect:Se,ariaDescribedById:{draggable:H},dispatch:g,draggableNodes:M,over:Fc,measureDroppableContainers:Ae}),[G,gn,F,Se,g,H,M,Fc,Ae]);return be.default.createElement(CUt.Provider,{value:S},be.default.createElement(uae.Provider,{value:WM},be.default.createElement(BUt.Provider,{value:$O},be.default.createElement($Ut.Provider,{value:Da},l)),be.default.createElement(emn,{disabled:s?.restoreFocus===!1})),be.default.createElement(ahn,{...s,hiddenTextDescribedById:H}));function qO(){let ja=q?.autoScrollEnabled===!1,hs=typeof u=="object"?u.enabled===!1:u===!1,oa=T&&!ja&&!hs;return typeof u=="object"?{...u,enabled:oa}:{enabled:oa}}}),omn=(0,be.createContext)(null),xUt="button",imn="Draggable";function qUt(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=KD(imn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,be.useContext)(uae),{role:p=xUt,roleDescription:h="draggable",tabIndex:m=0}=o??{},v=u?.id===e,g=(0,be.useContext)(v?$Ut:omn),[_,S]=V6(),[x,O]=V6(),T=Hhn(a,e),E=nq(r);Nm(()=>(d.set(e,{id:e,key:i,node:_,activatorNode:x,data:E}),()=>{let R=d.get(e);R&&R.key===i&&d.delete(e)}),[d,e]);let M=(0,be.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":v&&p===xUt?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,v,h,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:M,isDragging:v,listeners:n?void 0:T,node:_,over:f,setNodeRef:S,setActivatorNodeRef:O,transform:g}}function UUt(){return(0,be.useContext)(BUt)}var amn="Droppable",smn={timeout:25};function zUt(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=KD(amn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,be.useContext)(uae),c=(0,be.useRef)({disabled:r}),d=(0,be.useRef)(!1),f=(0,be.useRef)(null),p=(0,be.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:v}={...smn,...o},g=nq(m??n),_=(0,be.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},v)},[v]),S=sae({callback:_,disabled:h||!a}),x=(0,be.useCallback)((M,R)=>{S&&(R&&(S.unobserve(R),d.current=!1),M&&S.observe(M))},[S]),[O,T]=V6(x),E=nq(e);return(0,be.useEffect)(()=>{!S||!O.current||(S.disconnect(),d.current=!1,S.observe(O.current))},[O,S]),(0,be.useEffect)(()=>(s({type:pl.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:E}}),()=>s({type:pl.UnregisterDroppable,key:i,id:n})),[n]),(0,be.useEffect)(()=>{r!==c.current.disabled&&(s({type:pl.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:O,over:u,setNodeRef:T}}var ps=B(Z());function fae(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function umn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function lae(t){return t!==null&&t>=0}function lmn(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function cmn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var HUt=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=fae(e,n,r),a=e[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}};var cae={scaleX:1,scaleY:1},kIe=t=>{var e;let{activeIndex:r,activeNodeRect:n,index:o,rects:i,overIndex:a}=t,s=(e=i[r])!=null?e:n;if(!s)return null;if(o===r){let l=i[a];return l?{x:0,y:r<a?l.top+l.height-(s.top+s.height):l.top-s.top,...cae}:null}let u=dmn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...cae}:o<r&&o>=a?{x:0,y:s.height+u,...cae}:{x:0,y:0,...cae}};function dmn(t,e,r){let n=t[e],o=t[e-1],i=t[e+1];return n?r<e?o?n.top-(o.top+o.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}var VUt="Sortable",WUt=ps.default.createContext({activeIndex:-1,containerId:VUt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:HUt,disabled:{draggable:!1,droppable:!1}});function BIe(t){let{children:e,id:r,items:n,strategy:o=HUt,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=UUt(),d=KD(VUt,r),f=Boolean(s.rect!==null),p=(0,ps.useMemo)(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),h=a!=null,m=a?p.indexOf(a.id):-1,v=l?p.indexOf(l.id):-1,g=(0,ps.useRef)(p),_=!lmn(p,g.current),S=v!==-1&&m===-1||_,x=cmn(i);Nm(()=>{_&&h&&c(p)},[_,p,h,c]),(0,ps.useEffect)(()=>{g.current=p},[p]);let O=(0,ps.useMemo)(()=>({activeIndex:m,containerId:d,disabled:x,disableTransforms:S,items:p,overIndex:v,useDragOverlay:f,sortedRects:umn(p,u),strategy:o}),[m,d,x.draggable,x.droppable,S,p,v,u,f,o]);return ps.default.createElement(WUt.Provider,{value:O},e)}var fmn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return fae(r,n,o).indexOf(e)},pmn=t=>{let{containerId:e,isSorting:r,wasDragging:n,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:u,transition:l}=t;return!l||!n||s!==i&&o===a?!1:r?!0:a!==o&&e===u},hmn={duration:200,easing:"ease"},JUt="transform",mmn=FO.Transition.toString({property:JUt,duration:0,easing:"linear"}),gmn={roleDescription:"sortable"};function ymn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,ps.useState)(null),s=(0,ps.useRef)(r);return Nm(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=rj(n.current,{ignoreTransform:!0}),c={x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height};(c.x||c.y)&&a(c)}}r!==s.current&&(s.current=r)},[e,r,n,o]),(0,ps.useEffect)(()=>{i&&a(null)},[i]),i}function $Ie(t){let{animateLayoutChanges:e=pmn,attributes:r,disabled:n,data:o,getNewIndex:i=fmn,id:a,strategy:s,resizeObserverConfig:u,transition:l=hmn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:m,overIndex:v,useDragOverlay:g,strategy:_}=(0,ps.useContext)(WUt),S=bmn(n,p),x=c.indexOf(a),O=(0,ps.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),T=(0,ps.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:M,isOver:R,setNodeRef:N}=zUt({id:a,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:j,activatorEvent:k,activeNodeRect:F,attributes:L,setNodeRef:q,listeners:U,isDragging:G,over:V,setActivatorNodeRef:I,transform:H}=qUt({id:a,data:O,attributes:{...gmn,...r},disabled:S.draggable}),W=iUt(N,q),J=Boolean(j),re=J&&!h&&lae(f)&&lae(v),Ae=!g&&G,Y=Ae&&re?H:null,le=re?Y??(s??_)({rects:m,activeNodeRect:F,activeIndex:f,overIndex:v,index:x}):null,Re=lae(f)&&lae(v)?i({id:a,items:c,activeIndex:f,overIndex:v}):x,gt=j?.id,Se=(0,ps.useRef)({activeId:gt,items:c,newIndex:Re,containerId:d}),ae=c!==Se.current.items,ee=e({active:j,containerId:d,isDragging:G,isSorting:J,id:a,index:x,items:c,newIndex:Se.current.newIndex,previousItems:Se.current.items,previousContainerId:Se.current.containerId,transition:l,wasDragging:Se.current.activeId!=null}),ye=ymn({disabled:!ee,index:x,node:M,rect:E});return(0,ps.useEffect)(()=>{J&&Se.current.newIndex!==Re&&(Se.current.newIndex=Re),d!==Se.current.containerId&&(Se.current.containerId=d),c!==Se.current.items&&(Se.current.items=c)},[J,Re,d,c]),(0,ps.useEffect)(()=>{if(gt===Se.current.activeId)return;if(gt!=null&&Se.current.activeId==null){Se.current.activeId=gt;return}let ft=setTimeout(()=>{Se.current.activeId=gt},50);return()=>clearTimeout(ft)},[gt]),{active:j,activeIndex:f,attributes:L,data:O,rect:E,index:x,newIndex:Re,items:c,isOver:R,isSorting:J,isDragging:G,listeners:U,node:M,overIndex:v,over:V,setNodeRef:W,setActivatorNodeRef:I,setDroppableNodeRef:N,setDraggableNodeRef:q,transform:ye??le,transition:Ue()};function Ue(){if(ye||ae&&Se.current.newIndex===x)return mmn;if(!(Ae&&!W6(k)||!l)&&(J||ee))return FO.Transition.toString({...l,property:JUt})}}function bmn(t,e){var r,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t?.draggable)!=null?r:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function dae(t){if(!t)return!1;let e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}var _mn=[hn.Down,hn.Right,hn.Up,hn.Left],GUt=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(_mn.includes(t.code)){if(t.preventDefault(),!r||!n)return;let u=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=o.get(d.id);if(f)switch(t.code){case 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=TUt({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=NIe(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 v=X6(h).some((T,E)=>s[E]!==T),g=KUt(d,f),_=vmn(d,f),S=v||!g?{x:0,y:0}:{x:_?n.width-p.width:0,y:_?n.height-p.height:0},x={x:p.left,y:p.top};return S.x&&S.y?x:XD(x,S)}}}};function KUt(t,e){return!dae(t)||!dae(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function vmn(t,e){return!dae(t)||!dae(e)||!KUt(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}var wmn={["reasoning"]:{icon:iR,color:"text-model-capabilities-blue",tooltip:mE.reasoning},["vision"]:{icon:xx,color:"text-model-capabilities-green",tooltip:mE.vision},["websearch"]:{icon:oR,color:"text-model-capabilities-blue",tooltip:mE.websearch}},Smn=t=>$e.default.createElement(gd,{delayDuration:0},$e.default.createElement("div",{className:"flex gap-2 items-center justify-center"},t.capabilities?.map(e=>{let r=wmn[e];if(!r)return null;let n=r.icon;return $e.default.createElement(Jr,{key:e},$e.default.createElement(Gr,{asChild:!0},$e.default.createElement(n,{className:`h-4 w-4 ${r.color}`})),$e.default.createElement(Hr,{side:"bottom"},r.tooltip))}))),xmn=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,id:o})=>{let[i,a]=$e.default.useState(!1),{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=$Ie({id:o,disabled:t.core}),p={transform:FO.Transform.toString(c),transition:d};return $e.default.createElement(D6,{ref:l,style:p,className:Te("mb-2",f&&["opacity-90","shadow-lg","border-2","border-accent/50","relative","z-[9999]","bg-background","rounded-lg","transform-gpu"],!t.core&&"touch-none")},$e.default.createElement(j6,{className:"p-3"},$e.default.createElement("div",{className:"flex items-center justify-between"},!t.core&&$e.default.createElement("div",{className:"mr-2 touch-none cursor-grab active:cursor-grabbing",...s,...u},$e.default.createElement(RN,{className:"h-4 w-4 text-muted-foreground"})),$e.default.createElement("div",{className:"flex-1 cursor-pointer",onClick:()=>a(!i)},$e.default.createElement("div",{className:"flex items-center gap-2"},$e.default.createElement("div",{className:"w-3 h-3 flex items-center justify-center"},i?$e.default.createElement(Sl,{className:"h-3 w-3 stroke-[7]"}):$e.default.createElement(ZA,{className:"h-3 w-3 stroke-[7]"})),$e.default.createElement("div",null,$e.default.createElement("div",{className:"flex items-center gap-1"},$e.default.createElement("span",{className:"font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&$e.default.createElement(cAe,{capabilities:t.capabilities,iconSize:14})),$e.default.createElement("div",{className:"flex items-center gap-2"},$e.default.createElement("span",{className:"text-sm text-muted bg-secondary"},Zm(t.provider,t)))))),$e.default.createElement("div",{className:"flex items-center gap-2"},e&&$e.default.createElement(Ge,{variant:"ghost",size:"icon",onClick:h=>{h.stopPropagation(),e()}},$e.default.createElement(IN,{className:"h-4 w-4"})),r&&!t.core&&$e.default.createElement(Ge,{variant:"ghost",size:"icon",onClick:h=>{h.stopPropagation(),r()}},$e.default.createElement(Cx,{className:"h-4 w-4"}))))),$e.default.createElement("div",{className:Te("transition-all duration-300 ease-in-out",i?"max-h-20 opacity-100":"max-h-0 opacity-0 overflow-hidden")},$e.default.createElement(N6,{className:"p-3 pt-0"},$e.default.createElement("div",{className:"flex justify-around"},!t.isEmbeddingModel&&$e.default.createElement("div",{className:"flex items-center gap-2"},$e.default.createElement("span",{className:"text-sm"},"Enabled"),$e.default.createElement(hy,{checked:t.enabled,onCheckedChange:h=>n({...t,enabled:h})})),$e.default.createElement("div",{className:"flex items-center gap-2"},$e.default.createElement("span",{className:"text-sm"},"CORS"),$e.default.createElement(hy,{checked:t.enableCors,onCheckedChange:h=>n({...t,enableCors:h})}))))))},Cmn=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,isEmbeddingModel:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=$Ie({id:an(t),disabled:t.core}),d={transform:FO.Transform.toString(u),transition:l};return $e.default.createElement(Zie,{ref:s,style:d,className:Te("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")},$e.default.createElement(LO,{className:"w-6 px-2"},!t.core&&$e.default.createElement(Ge,{variant:"ghost",size:"icon",className:"cursor-grab touch-none hover:cursor-grab active:cursor-grabbing p-0 h-6 w-6",...i,...a},$e.default.createElement(RN,{className:"h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"}))),$e.default.createElement(LO,{className:"pl-0"},t.displayName||t.name),$e.default.createElement(LO,null,Zm(t.provider,t)),$e.default.createElement(LO,{className:"text-center"},Smn(t)),!o&&$e.default.createElement(LO,{className:"text-center"},$e.default.createElement(hy,{id:`${an(t)}-enabled`,checked:t.enabled,onCheckedChange:f=>n({...t,enabled:f}),className:"mx-auto"})),$e.default.createElement(LO,{className:"text-center"},$e.default.createElement(hy,{id:`${an(t)}-enableCors`,checked:t.enableCors,onCheckedChange:f=>n({...t,enableCors:f}),className:"mx-auto"})),$e.default.createElement(LO,{className:"text-center"},$e.default.createElement("div",{className:"flex justify-center gap-2"},e&&$e.default.createElement(Ge,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"shadow-sm hover:shadow-md transition-shadow"},$e.default.createElement(IN,{className:"h-4 w-4"})),!t.core&&$e.default.createElement(Ge,{variant:"ghost",size:"icon",onClick:()=>r(an(t)),className:"shadow-sm hover:shadow-md transition-shadow"},$e.default.createElement(Cx,{className:"h-4 w-4"})))))},qIe=({models:t,onEdit:e,onDelete:r,onAdd:n,onUpdateModel:o,onReorderModels:i,title:a})=>{let s=!!(t.length>0&&t[0].isEmbeddingModel),u=OUt(jIe(aq),jIe(iq,{coordinateGetter:GUt})),l=t.findIndex(p=>!p.core),c=p=>h=>{let{transform:m,active:v,activeNodeRect:g,over:_}=h;if(!v||!g)return m;let S=t.findIndex(M=>an(M)===v.id),x=t.filter(M=>!M.core).length,O=g.height,T=(l-S)*O,E=(l+x-1-S)*O;if(p&&_){let M=t.findIndex(N=>an(N)===_.id);if(t[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 v=t.findIndex(x=>an(x)===h.id),g=t.findIndex(x=>an(x)===m.id),_=t[g];if(g<l||_.core)return;let S=fae(t,v,g);i?.(S)}},f=()=>$e.default.createElement("div",{className:"md:hidden relative"},$e.default.createElement(FIe,{sensors:u,collisionDetection:LIe,onDragEnd:d,modifiers:[c(!0)]},$e.default.createElement(BIe,{items:t.map(p=>an(p)),strategy:kIe},$e.default.createElement("div",{className:"space-y-2 relative"},t.map(p=>$e.default.createElement(xmn,{key:an(p),id:an(p),model:p,onEdit:e?()=>e(p):void 0,onDelete:()=>r(an(p)),onUpdateModel:o}))))));return $e.default.createElement("div",{className:"mb-4"},$e.default.createElement("div",{className:"hidden md:block"},$e.default.createElement(FIe,{sensors:u,collisionDetection:LIe,onDragEnd:d,modifiers:[c(!1)]},$e.default.createElement("div",{className:"relative overflow-hidden"},$e.default.createElement(wIe,null,$e.default.createElement(SIe,null,$e.default.createElement(Zie,null,$e.default.createElement(NO,{className:"w-6 px-2"}),$e.default.createElement(NO,{className:"pl-0"},"Model"),$e.default.createElement(NO,null,"Provider"),$e.default.createElement(NO,{className:"text-center"},"Capabilities"),!s&&$e.default.createElement(NO,{className:"text-center"},"Enable"),$e.default.createElement(NO,{className:"text-center"},"CORS"),$e.default.createElement(NO,{className:"w-[100px] text-center"},"Actions"))),$e.default.createElement(xIe,{className:"relative"},$e.default.createElement(BIe,{items:t.map(p=>an(p)),strategy:kIe},t.map(p=>$e.default.createElement(Cmn,{key:an(p),model:p,onEdit:e?()=>e(p):void 0,onDelete:r,onUpdateModel:o,isEmbeddingModel:s})))))))),f(),$e.default.createElement("div",{className:"mt-4 flex justify-end"},$e.default.createElement(Ge,{onClick:n,variant:"secondary",className:"flex items-center gap-2"},$e.default.createElement(aR,{className:"h-4 w-4"}),"Add Custom Model")))};var Kt=B(Z());var YUt=({open:t,onOpenChange:e,model:r,onUpdate:n})=>{let{modalContainer:o}=DS(),[i,a]=(0,Kt.useState)(r);if((0,Kt.useEffect)(()=>{a(r)},[r]),!i)return null;let s=(l,c)=>{let d={...i,[l]:c};a(d),n(d)},u=Object.entries(mE).map(([l,c])=>({id:l,label:l.charAt(0).toUpperCase()+l.slice(1),description:c}));return Kt.default.createElement(LM,{open:t,onOpenChange:e},Kt.default.createElement(TO,{className:"sm:max-w-[425px]",container:o},Kt.default.createElement(MO,null,Kt.default.createElement(AO,null,"Model Settings - ",i.name),Kt.default.createElement(RO,null,"Customize model parameters.")),Kt.default.createElement("div",{className:"space-y-6"},Kt.default.createElement(vd,{label:"Model Name",required:!0},Kt.default.createElement(Ii,{type:"text",disabled:i.core,value:i.name,onChange:l=>s("name",l.target.value),placeholder:"Enter model name"})),Kt.default.createElement(vd,{label:Kt.default.createElement("div",{className:"flex items-center gap-1.5"},Kt.default.createElement("span",{className:"leading-none"},"Display Name"),Kt.default.createElement(gd,{delayDuration:0},Kt.default.createElement(Jr,null,Kt.default.createElement(Gr,{asChild:!0},Kt.default.createElement(xl,{className:"size-4"})),Kt.default.createElement(Hr,{align:"start",className:"max-w-96",side:"bottom"},Kt.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-0.5"},Kt.default.createElement("div",{className:"text-[12px] font-bold"},"Suggested format:"),Kt.default.createElement("div",{className:"text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Kt.default.createElement("div",{className:"text-[12px]"},"Example:",Kt.default.createElement("li",null,"Direct-Paid:Ds-r1"),Kt.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Kt.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Kt.default.createElement(Ii,{type:"text",placeholder:"Custom display name (optional)",value:i.displayName||"",onChange:l=>s("displayName",l.target.value)})),Kt.default.createElement(vd,{label:"Model Capabilities"},Kt.default.createElement("div",{className:"flex gap-4 items-center"},u.map(({id:l,label:c,description:d})=>Kt.default.createElement("div",{key:l,className:"flex items-center gap-2"},Kt.default.createElement(hy,{id:l,checked:i.capabilities?.includes(l),onCheckedChange:f=>{let p=i.capabilities||[];s("capabilities",f?[...p,l]:p.filter(h=>h!==l))}}),Kt.default.createElement(DO,{htmlFor:l,className:"text-sm"},Kt.default.createElement(gd,{delayDuration:0},Kt.default.createElement(Jr,null,Kt.default.createElement(Gr,{asChild:!0},Kt.default.createElement("span",null,c)),Kt.default.createElement(Hr,{side:"bottom"},d)))))))),Kt.default.createElement("div",{className:"flex items-center justify-between py-2"},Kt.default.createElement("div",{className:"flex items-center gap-2"},Kt.default.createElement("span",{className:"text-sm font-medium"},"Stream output"),Kt.default.createElement(gd,{delayDuration:0},Kt.default.createElement(Jr,null,Kt.default.createElement(Gr,{asChild:!0},Kt.default.createElement(xl,{className:"h-4 w-4 text-muted"})),Kt.default.createElement(Hr,{side:"bottom"},"Enable streaming responses from the model")))),Kt.default.createElement(MS,{checked:i.stream??!0,onCheckedChange:l=>s("stream",l)})))))};var Omn=()=>{let t=Fa(),[e,r]=(0,ta.useState)(null),[n,o]=(0,ta.useState)(!1),[i,a]=(0,ta.useState)(!1),s=p=>{let[h,m]=p.split("|"),v=t.activeModels.filter(_=>!(_.name===h&&_.provider===m)),g=t.defaultModelKey;if(p===t.defaultModelKey){let _=v.find(S=>S.enabled);g=_?`${_.name}|${_.provider}`:""}cE({activeModels:v,defaultModelKey:g})},u=p=>{let h=t.activeModels.map(m=>m.name===p.name&&m.provider===p.provider?p:m);Ft("activeModels",h)},l=p=>{Ft("activeModels",p)},c=p=>{let[h,m]=p.split("|"),v=t.activeEmbeddingModels.filter(g=>!(g.name===h&&g.provider===m));Ft("activeEmbeddingModels",v)},d=p=>{let h=t.activeEmbeddingModels.map(m=>m.name===p.name&&m.provider===p.provider?p:m);Ft("activeEmbeddingModels",h)},f=p=>{Ft("activeEmbeddingModels",p)};return ta.default.createElement("div",{className:"space-y-4"},ta.default.createElement("section",null,ta.default.createElement("div",{className:"text-xl font-bold mb-3"},"Chat Models"),ta.default.createElement(qIe,{models:t.activeModels,onEdit:r,onDelete:s,onAdd:()=>o(!0),onUpdateModel:u,onReorderModels:l,title:"Chat Model"}),ta.default.createElement(YUt,{open:!!e,onOpenChange:p=>!p&&r(null),model:e,onUpdate:u}),ta.default.createElement(vIe,{open:n,onOpenChange:o,onAdd:p=>{let h=[...t.activeModels,p];Ft("activeModels",h)},ping:p=>Eo.getInstance().ping(p)}),ta.default.createElement("div",{className:"space-y-4"},ta.default.createElement(yo,{type:"slider",title:"Temperature",description:"Default is 0.1. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.",value:t.temperature,onChange:p=>Ft("temperature",p),min:0,max:2,step:.05}),ta.default.createElement(yo,{type:"slider",title:"Token limit",description:ta.default.createElement(ta.default.Fragment,null,ta.default.createElement("p",null,"The maximum number of ",ta.default.createElement("em",null,"output tokens")," to generate. Default is 1000."),ta.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model.")),value:t.maxTokens,onChange:p=>Ft("maxTokens",p),min:0,max:16e3,step:100}),ta.default.createElement(yo,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:p=>Ft("contextTurns",p),min:1,max:50,step:1}))),ta.default.createElement("section",null,ta.default.createElement("div",{className:"text-xl font-bold mb-3"},"Embedding Models"),ta.default.createElement(qIe,{models:t.activeEmbeddingModels,onDelete:c,onAdd:()=>a(!0),onUpdateModel:d,onReorderModels:f,title:"Embedding Model"}),ta.default.createElement(vIe,{open:i,onOpenChange:a,onAdd:p=>{let h=[...t.activeEmbeddingModels,p];Ft("activeEmbeddingModels",h)},isEmbeddingModel:!0,ping:p=>vo.getInstance().ping(p)})))},XUt=Omn;var ozt=require("obsidian");var Kr=B(Z()),izt=B(lg());var ZUt=require("obsidian"),pae=class extends ZUt.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)uU(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var QUt=require("obsidian");var hae=class extends QUt.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=XQ(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 ezt=require("obsidian"),Fm=B(Z()),tzt=B(lg());function Emn({onConfirm:t,onCancel:e}){let[r,n]=(0,Fm.useState)(""),[o,i]=(0,Fm.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return Fm.default.createElement("div",{className:"flex flex-col gap-4"},Fm.default.createElement("div",{className:"flex flex-col gap-2"},Fm.default.createElement(Ii,{placeholder:"Enter the extension (e.g. txt, excalidraw)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&a(r)}}),o&&Fm.default.createElement("p",{className:"text-error text-sm"},o)),Fm.default.createElement("div",{className:"flex justify-end gap-2"},Fm.default.createElement(Ge,{variant:"secondary",onClick:e},"Cancel"),Fm.default.createElement(Ge,{variant:"default",onClick:()=>a(r)},"Confirm")))}var mae=class extends ezt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,tzt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Fm.default.createElement(Emn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var rzt=require("obsidian"),gy=B(Z()),nzt=B(lg());function Pmn({onConfirm:t,onCancel:e}){let[r,n]=(0,gy.useState)("");return gy.default.createElement("div",{className:"flex flex-col gap-4"},gy.default.createElement("div",{className:"flex flex-col gap-4"},gy.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"),gy.default.createElement(Ii,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),gy.default.createElement("div",{className:"flex justify-end gap-2"},gy.default.createElement(Ge,{variant:"secondary",onClick:e},"Cancel"),gy.default.createElement(Ge,{variant:"default",onClick:()=>t(r)},"Confirm")))}var gae=class extends rzt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,nzt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(gy.default.createElement(Pmn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function yae({title:t,patterns:e,onRemove:r}){return Kr.default.createElement("div",{className:"grid grid-cols-4 gap-2"},Kr.default.createElement("div",{className:"font-bold"},t),Kr.default.createElement("ul",{className:"list-disc list-inside pl-0 m-0 col-span-3 flex flex-col gap-1"},e.map(n=>Kr.default.createElement("li",{key:n,className:"flex gap-2 hover:bg-dropdown-hover pl-2 pr-1 rounded-md"},Kr.default.createElement("span",{className:"flex-1 truncate whitespace-nowrap"},n),Kr.default.createElement(Ge,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Kr.default.createElement(Ch,{className:"size-4"}))))))}function Tmn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Kr.useState)(t),i=dT(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=q3(i),c=f=>{let p=Uvt({tagPatterns:f.tagPatterns??a,extensionPatterns:f.extensionPatterns??s,folderPatterns:f.folderPatterns??u,notePatterns:f.notePatterns??l});o(p),e(p)},d=a.length>0||s.length>0||u.length>0||l.length>0;return Kr.default.createElement("div",{className:"flex flex-col gap-4 mt-2"},Kr.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&&Kr.default.createElement("div",{className:"text-center text-sm text-muted-foreground"},"No patterns specified"),a.length>0&&Kr.default.createElement(yae,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(h=>h!==f);c({tagPatterns:p})}}),s.length>0&&Kr.default.createElement(yae,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(h=>h!==f);c({extensionPatterns:p})}}),u.length>0&&Kr.default.createElement(yae,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(h=>h!==f);c({folderPatterns:p})}}),l.length>0&&Kr.default.createElement(yae,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(h=>h!==f);c({notePatterns:p})}})),Kr.default.createElement("div",{className:"flex justify-end gap-2"},Kr.default.createElement(nie,null,Kr.default.createElement(oie,{asChild:!0},Kr.default.createElement(Ge,{variant:"secondary"},"Add...")),Kr.default.createElement(OM,{align:"start",container:r},Kr.default.createElement(Tc,{onSelect:()=>{new pae(app,f=>{let p=`#${f}`;a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Kr.default.createElement("div",{className:"flex items-center gap-2"},Kr.default.createElement(Pz,{className:"size-4"}),"Tag")),Kr.default.createElement(Tc,{onSelect:()=>{new hae(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Kr.default.createElement("div",{className:"flex items-center gap-2"},Kr.default.createElement(bz,{className:"size-4"}),"Folder")),Kr.default.createElement(Tc,{onSelect:()=>{new PM({app,onNoteSelect:f=>{let p=`[[${f.basename}]]`;l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Kr.default.createElement("div",{className:"flex items-center gap-2"},Kr.default.createElement(nR,{className:"size-4"}),"Note")),Kr.default.createElement(Tc,{onSelect:()=>{new mae(app,f=>{let p=`*.${f}`;s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Kr.default.createElement("div",{className:"flex items-center gap-2"},Kr.default.createElement(yz,{className:"size-4"}),"Extension")),Kr.default.createElement(Tc,{onSelect:()=>{new gae(app,f=>{let p=dT(f),{tagPatterns:h,extensionPatterns:m,folderPatterns:v,notePatterns:g}=q3(p);c({tagPatterns:[...a,...h],extensionPatterns:[...s,...m],folderPatterns:[...u,...v],notePatterns:[...l,...g]})}).open()}},Kr.default.createElement("div",{className:"flex items-center gap-2"},Kr.default.createElement(sR,{className:"size-4"}),"Custom"))))))}var Z6=class extends ozt.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,izt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Kr.default.createElement(Tmn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var br=B(Z()),Mmn=({indexVaultToVectorStore:t})=>{let e=Fa(),r=n=>{let o=parseInt(n);o!==e.numPartitions&&new Y$(app,async()=>{Ft("numPartitions",o),await t(!0)}).open()};return br.default.createElement("div",{className:"space-y-4"},br.default.createElement("section",null,br.default.createElement("div",{className:"space-y-4"},br.default.createElement(yo,{type:"select",title:"Auto-Index Strategy",description:br.default.createElement("div",{className:"flex items-center gap-1.5"},br.default.createElement("span",{className:"leading-none"},"Decide when you want the vault to be indexed."),br.default.createElement(gd,{delayDuration:0},br.default.createElement(Jr,null,br.default.createElement(Gr,{asChild:!0},br.default.createElement(xl,{className:"size-4"})),br.default.createElement(Hr,null,br.default.createElement("div",{className:"space-y-2 py-2"},br.default.createElement("div",{className:"space-y-1"},br.default.createElement("div",{className:"text-muted text-sm"},"Choose when to index your vault:"),br.default.createElement("ul",{className:"space-y-1 pl-2 list-disc text-sm"},br.default.createElement("li",null,br.default.createElement("div",{className:"flex items-center gap-1"},br.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"NEVER:"),br.default.createElement("span",null,"Manual indexing via command or refresh only"))),br.default.createElement("li",null,br.default.createElement("div",{className:"flex items-center gap-1"},br.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON STARTUP:"),br.default.createElement("span",null,"Index updates when plugin loads or reloads"))),br.default.createElement("li",null,br.default.createElement("div",{className:"flex items-center gap-1"},br.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON MODE SWITCH:"),br.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),br.default.createElement("p",{className:"text-callout-warning text-sm"},"Warning: Cost implications for large vaults with paid models")))))),value:e.indexVaultToVectorStore,onChange:n=>{Ft("indexVaultToVectorStore",n)},options:Pke.map(n=>({label:n,value:n})),placeholder:"Strategy"}),br.default.createElement(yo,{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:n=>Ft("maxSourceChunks",n)}),br.default.createElement(yo,{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:n=>Ft("embeddingRequestsPerMin",n)}),br.default.createElement(yo,{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:n=>Ft("embeddingBatchSize",n)}),br.default.createElement(yo,{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:r,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(n=>({label:n,value:n}))}),br.default.createElement(yo,{type:"custom",title:"Exclusions",description:br.default.createElement(br.default.Fragment,null,br.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."))},br.default.createElement(Ge,{variant:"secondary",onClick:()=>new Z6(app,n=>Ft("qaExclusions",n),e.qaExclusions,"Manage Exclusions").open()},"Manage")),br.default.createElement(yo,{type:"custom",title:"Inclusions",description:br.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.")},br.default.createElement(Ge,{variant:"secondary",onClick:()=>new Z6(app,n=>Ft("qaInclusions",n),e.qaInclusions,"Manage Inclusions").open()},"Manage")),br.default.createElement(yo,{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:n=>Ft("enableIndexSync",n)}),br.default.createElement(yo,{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:n=>Ft("disableIndexOnMobile",n)}))))},azt=Mmn;var uzt=["basic","model","QA","advanced"],Amn={basic:mn.default.createElement(dz,{className:"w-5 h-5"}),model:mn.default.createElement(pz,{className:"w-5 h-5"}),QA:mn.default.createElement(hz,{className:"w-5 h-5"}),advanced:mn.default.createElement(sR,{className:"w-5 h-5"})},Rmn=t=>({basic:()=>mn.default.createElement(P$t,{indexVaultToVectorStore:t.vectorStoreManager.indexVaultToVectorStore.bind(t.vectorStoreManager)}),model:()=>mn.default.createElement(XUt,null),QA:()=>mn.default.createElement(azt,{indexVaultToVectorStore:t.vectorStoreManager.indexVaultToVectorStore.bind(t.vectorStoreManager)}),advanced:S$t}),szt=uzt.map(t=>({id:t,icon:Amn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),Imn=({plugin:t})=>{let{selectedTab:e,setSelectedTab:r}=DS();return mn.default.createElement("div",{className:"flex flex-col"},mn.default.createElement("div",{className:"inline-flex rounded-lg"},szt.map((n,o)=>mn.default.createElement(eBt,{key:n.id,tab:n,isSelected:e===n.id,onClick:()=>r(n.id),isFirst:o===0,isLast:o===szt.length-1}))),mn.default.createElement("div",{className:"w-[100%] border border-solid"}),mn.default.createElement("div",null,uzt.map(n=>{let o=Rmn(t)[n];return mn.default.createElement(tBt,{key:n,id:n,isSelected:e===n},mn.default.createElement(o,null))})))},Dmn=({plugin:t})=>{let[e,r]=mn.default.useState(0),[n,o]=(0,mn.useState)(null),[i,a]=(0,mn.useState)(null);(0,mn.useEffect)(()=>{(async()=>{let{version:c,error:d}=await xke();d?(console.error("Version check failed:",d),a(d)):c&&(o(c),a(null))})()},[t.manifest.version]);let s=async()=>{new jie(app,async()=>{lke(),r(c=>c+1)}).open()},u=n&&Ske(n,t.manifest.version);return mn.default.createElement(nBt,null,mn.default.createElement("div",null,mn.default.createElement("div",{className:"flex flex-col gap-2"},mn.default.createElement("h1",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"},mn.default.createElement("div",{className:"flex items-center gap-2"},mn.default.createElement("span",null,"Copilot Settings"),mn.default.createElement("span",{className:"text-xs text-muted"},"v",t.manifest.version,i?mn.default.createElement("span",{className:"text-error",title:i}," ","(update check failed)"):n&&mn.default.createElement(mn.default.Fragment,null,u?mn.default.createElement("span",{className:"text-accent",title:"A new version is available"}," ","(latest: v",n,")"):mn.default.createElement("span",{className:"text-accent"}," (up to date)")))),mn.default.createElement("div",{className:"self-end sm:self-auto"},mn.default.createElement(Ge,{variant:"secondary",size:"sm",onClick:s},"Reset Settings")))),mn.default.createElement(Imn,{key:e,plugin:t})))},lzt=Dmn;var bae=class extends Q6.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(_l)[0]?.view&&me().autosaveChat&&await this.plugin.autosaveCurrentChat();let n=this.plugin.app;await n.plugins.disablePlugin("copilot"),await n.plugins.enablePlugin("copilot"),n.setting.openTabById("copilot").display(),new Q6.Notice("Plugin reloaded successfully.")}catch(r){new Q6.Notice("Failed to reload the plugin. Please reload manually."),console.error("Error reloading plugin:",r)}}display(){let{containerEl:r}=this;r.empty(),r.style.userSelect="text";let n=r.createDiv("div");(0,dzt.createRoot)(n).render(czt.default.createElement(lzt,{plugin:this.plugin}))}};var fzt=B(KQ()),kO=class{constructor(){this.cacheDir=".copilot/pdf-cache"}static getInstance(){return kO.instance||(kO.instance=new kO),kO.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(hr("Creating PDF cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){let r=`${e.path}:${e.stat.size}:${e.stat.mtime}`,n=(0,fzt.MD5)(r).toString();return hr("Generated cache key for PDF:",{path:e.path,key:n}),n}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.getCachePath(r);if(await app.vault.adapter.exists(n)){hr("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return hr("Cache miss for PDF:",e.path),null}catch(r){return Mo("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);hr("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){Mo("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);hr("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){Mo("Error clearing PDF cache:",e)}}};var UIe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},_ae=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=kO.getInstance()}async parseFile(e,r){try{hr("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return hr("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);hr("Calling pdf4llm API for:",e.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(e,i),i.response}catch(n){return Mo(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){hr("Clearing PDF cache"),await this.pdfCache.clear()}},vae=class{constructor(e){this.parsers=new Map;this.registerParser(new UIe),this.registerParser(new _ae(e))}registerParser(e){for(let r of e.supportedExtensions)this.parsers.set(r,e)}async parseFile(e,r){let n=this.parsers.get(e.extension);if(!n)throw new Error(`No parser found for file type: ${e.extension}`);return await n.parseFile(e,r)}supportsExtension(e){return this.parsers.has(e)}async clearPDFCache(){let e=this.parsers.get("pdf");e instanceof _ae&&await e.clearCache()}};var BO=require("obsidian");var wae=class extends BO.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.handleContextMenu=(r,n)=>{Xkt(r,n,this)}}async onload(){await this.loadSettings(),this.settingsUnsubscriber=bl(async()=>{let r=me();r.enableEncryption?await this.saveData(await Ike(r)):await this.saveData(r),NTe(this)}),this.addSettingTab(new bae(this.app,this)),this.sharedState=new Wkt,this.vectorStoreManager=Ki.getInstance(),this.brevilabsClient=Sa.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),ree(),this.chainManager=new xS(this.app,this.vectorStoreManager),this.fileParserManager=new vae(this.brevilabsClient),this.registerView(_l,r=>new DM(r,this)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),NTe(this),wD.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 BO.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(_l).find(i=>i.view instanceof DM)?.view;if(o){let i=new CustomEvent(dx.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(me().autosaveChat){let r=this.app.workspace.getLeavesOfType(_l)[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(_l).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(_l).find(l=>l.view instanceof DM)?.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(_l).find(n=>n.view instanceof DM)?.view;if(r){let n=new CustomEvent(dx.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===_l&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(BO.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(_l).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(_l);r.length===0?me().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:_l,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:_l,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(_l)}async loadSettings(){let r=await this.loadData(),n=cke(r);cE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=an(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 BO.Notice("No chat history found.");return}new Die(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(me().defaultSaveFolder);return r instanceof BO.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=b1t(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await QH(o,this.chainManager.memoryManager);let i=this.app.workspace.getLeavesOfType(_l)[0];i?i.view.updateView():this.activateView()}async customSearchDB(r,n,o){return(await new qT({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}};
/*! Bundled license information:
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*)
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2013-2021 Joachim Wester
* MIT license
*)
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
moment/moment.js:
(*! moment.js *)
(*! version : 2.29.4 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
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.
*)
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
*)
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.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-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/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/move.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.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 */